/* =============================================================================
   ROADBOOK - Styles CSS (Mobile-First PWA)
   ============================================================================= */

:root {
    /* Couleurs principales - surchargeables par le theme */
    --primary: #487854;
    --primary-dark: #3a6344;
    --primary-light: #5a9468;
    --primary-rgb: 72, 120, 84;
    --primary-50: #f0fdf4;
    --primary-100: #dcfce7;
    --primary-200: #bbf7d0;
    /* Couleurs fixes */
    --success: #28a745;
    --warning: #ffc107;
    --danger: #dc3545;
    --info: #17a2b8;
    --dark: #1f2937;
    --gray: #6b7280;
    --light: #f5f6f7;
    --white: #ffffff;
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
    --radius: 8px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--light);
    color: var(--dark);
    min-height: 100vh;
    line-height: 1.5;
}

/* Container */
.container {
    max-width: 480px;
    margin: 0 auto;
    padding: 1rem;
}

.container-wide {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
}

/* =============================================================================
   Page de Connexion (Login)
   ============================================================================= */

.login-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    padding: 2rem 1rem;
}

.login-logo {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

.login-title {
    color: var(--white);
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 2rem;
    text-align: center;
}

.login-box {
    background: var(--white);
    border-radius: var(--radius);
    padding: 2rem;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow);
}

.login-box h2 {
    text-align: center;
    margin-bottom: 1.5rem;
    color: var(--dark);
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--dark);
}

.form-control {
    width: 100%;
    padding: 0.875rem 1rem;
    font-size: 1rem;
    border: 2px solid var(--light);
    border-radius: var(--radius);
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-success {
    background: var(--success);
    color: var(--white);
}

.btn-warning {
    background: var(--warning);
    color: var(--dark);
}

.btn-danger {
    background: var(--danger);
    color: var(--white);
}

.btn-info {
    background: var(--info);
    color: var(--white);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.125rem;
}

.btn-icon {
    width: 48px;
    height: 48px;
    padding: 0;
    border-radius: 50%;
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-weight: 500;
}

.alert-success { background: #dcfce7; color: #166534; }
.alert-error { background: #fee2e2; color: #991b1b; }
.alert-warning { background: #fef3c7; color: #92400e; }
.alert-info { background: #dbeafe; color: #1e40af; }

/* Admin link on login page */
.admin-link {
    margin-top: 1.5rem;
    text-align: center;
}

.admin-link a {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    font-size: 0.875rem;
}

.admin-link a:hover {
    color: var(--white);
    text-decoration: underline;
}

/* =============================================================================
   Splash Screen (intro animée page d'accueil)
   ============================================================================= */

.splash-screen {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.25rem;
    padding: 2rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    cursor: pointer;
    opacity: 1;
    transition: opacity 0.6s ease;
}

/* Empêche le défilement pendant l'affichage du splash */
body.splash-active {
    overflow: hidden;
}

.splash-screen.is-hidden {
    opacity: 0;
    pointer-events: none;
}

.splash-logo {
    width: 150px;
    max-width: 45vw;
    height: auto;
    filter: drop-shadow(0 10px 28px rgba(0, 0, 0, 0.28));
    animation: splash-pop 0.9s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.splash-logo-emoji {
    font-size: 5rem;
    line-height: 1;
    animation: splash-pop 0.9s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.splash-title {
    margin: 0;
    color: var(--white);
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-align: center;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
    animation: splash-fade-up 0.7s ease 0.35s both;
}

.splash-subtitle {
    margin: -0.75rem 0 0;
    color: rgba(255, 255, 255, 0.85);
    font-size: 1rem;
    text-align: center;
    animation: splash-fade-up 0.7s ease 0.5s both;
}

.splash-loader {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
    animation: splash-fade-up 0.7s ease 0.65s both;
}

.splash-loader span {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    animation: splash-bounce 1s ease-in-out infinite;
}

.splash-loader span:nth-child(2) { animation-delay: 0.15s; }
.splash-loader span:nth-child(3) { animation-delay: 0.30s; }

@keyframes splash-pop {
    0%   { opacity: 0; transform: scale(0.6); }
    60%  { opacity: 1; transform: scale(1.08); }
    100% { opacity: 1; transform: scale(1); }
}

@keyframes splash-fade-up {
    0%   { opacity: 0; transform: translateY(12px); }
    100% { opacity: 1; transform: translateY(0); }
}

@keyframes splash-bounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
    40%           { transform: scale(1);   opacity: 1; }
}

/* Respect des préférences d'accessibilité : pas d'animations */
@media (prefers-reduced-motion: reduce) {
    .splash-screen,
    .splash-logo,
    .splash-logo-emoji,
    .splash-title,
    .splash-subtitle,
    .splash-loader,
    .splash-loader span {
        animation: none;
        transition: none;
    }
    .splash-loader span { opacity: 0.9; }
}

/* =============================================================================
   App Header
   ============================================================================= */

.app-header {
    background: var(--white);
    padding: 1rem;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.app-header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 480px;
    margin: 0 auto;
}

.app-logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
}

.player-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.player-points {
    background: var(--success);
    color: var(--white);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.875rem;
}

.player-timer {
    background: var(--primary);
    color: var(--white);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.875rem;
    font-family: monospace;
}

/* =============================================================================
   Roadbook Stages
   ============================================================================= */

.stage-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 1rem;
    overflow: hidden;
}

.stage-header {
    background: var(--primary);
    color: var(--white);
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stage-number {
    background: rgba(255,255,255,0.2);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-weight: 600;
}

.stage-status {
    font-size: 0.875rem;
}

.stage-body {
    padding: 1rem;
}

/* Phase tabs */
.phase-tabs {
    display: flex;
    border-bottom: 2px solid var(--light);
    margin-bottom: 1rem;
}

.phase-tab {
    flex: 1;
    padding: 0.75rem;
    text-align: center;
    font-weight: 600;
    color: var(--gray);
    background: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
}

.phase-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.phase-content {
    display: none;
}

.phase-content.active {
    display: block;
}

/* Directions */
.directions-box {
    background: var(--light);
    padding: 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
}

.directions-box h4 {
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.gps-button {
    margin-top: 1rem;
}

/* Photo */
.stage-photo {
    width: 100%;
    border-radius: var(--radius);
    margin-bottom: 1rem;
}

.photo-description {
    color: var(--gray);
    font-style: italic;
    text-align: center;
}

/* Questions */
.question-item {
    background: var(--light);
    padding: 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
}

.question-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.question-points {
    background: var(--warning);
    color: var(--dark);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.question-text {
    font-weight: 500;
    margin-bottom: 1rem;
}

.question-input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #ddd;
    border-radius: var(--radius);
    font-size: 1rem;
}

.question-status {
    margin-top: 0.5rem;
    padding: 0.5rem;
    border-radius: 4px;
    font-size: 0.875rem;
    text-align: center;
}

.question-status.pending { background: #fef3c7; color: #92400e; }
.question-status.correct { background: #dcfce7; color: #166534; }
.question-status.incorrect { background: #fee2e2; color: #991b1b; }

/* Camera capture */
.camera-capture {
    text-align: center;
}

.camera-preview {
    width: 100%;
    max-width: 300px;
    border-radius: var(--radius);
    margin-bottom: 1rem;
}

/* =============================================================================
   Admin Styles
   ============================================================================= */

.admin-header {
    background: var(--primary);
    color: var(--white);
    padding: 1rem;
    position: relative;
}

.admin-header-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.admin-header .app-logo {
    color: var(--white);
}

/* Bouton hamburger pour mobile */
.menu-toggle {
    display: none;
    background: rgba(255,255,255,0.1);
    border: none;
    color: var(--white);
    font-size: 1.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius);
    cursor: pointer;
}

.menu-toggle:hover {
    background: rgba(255,255,255,0.2);
}

.admin-nav {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.admin-nav a {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius);
    transition: all 0.2s;
    font-size: 0.9rem;
}

.admin-nav a:hover,
.admin-nav a.active {
    background: rgba(255,255,255,0.1);
    color: var(--white);
}

/* Navigation dropdown */
.nav-dropdown {
    position: relative;
    display: flex;
    align-items: center;
}

.nav-dropdown-toggle {
    cursor: pointer;
    display: flex;
    align-items: center;
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius);
    transition: all 0.2s;
    font-size: 0.9rem;
}

.nav-dropdown-toggle:hover,
.nav-dropdown.active .nav-dropdown-toggle {
    background: rgba(255,255,255,0.1);
    color: var(--white);
}

.nav-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    min-width: 150px;
    z-index: 1000;
    padding: 0.5rem 0;
    margin-top: 0.5rem;
}

.nav-dropdown.open .nav-dropdown-menu {
    display: block;
}

.nav-dropdown-menu a {
    display: block;
    padding: 0.5rem 1rem;
    color: var(--dark) !important;
    background: transparent !important;
    border-radius: 0;
}

.nav-dropdown-menu a:hover {
    background: var(--light) !important;
}

.nav-dropdown-menu a.active {
    color: var(--primary) !important;
    font-weight: 600;
}

/* Admin cards */
.admin-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.admin-card h3 {
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--light);
}

/* Player list in admin */
.player-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--light);
}

.player-row:last-child {
    border-bottom: none;
}

.player-details h4 {
    margin-bottom: 0.25rem;
}

.player-details span {
    color: var(--gray);
    font-size: 0.875rem;
}

.player-stats {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.timer-controls {
    display: flex;
    gap: 0.5rem;
}

/* Answer validation */
.answer-item {
    background: var(--light);
    padding: 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
}

.answer-player {
    font-weight: 600;
    color: var(--primary);
}

.answer-question {
    color: var(--gray);
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.answer-text {
    background: var(--white);
    padding: 0.75rem;
    border-radius: 8px;
    margin-bottom: 0.75rem;
}

.answer-photo {
    max-width: 200px;
    border-radius: 8px;
    margin-bottom: 0.75rem;
}

.validation-buttons {
    display: flex;
    gap: 0.5rem;
}

/* Stats grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-box {
    background: var(--white);
    padding: 1.5rem;
    border-radius: var(--radius);
    text-align: center;
    box-shadow: var(--shadow);
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
}

.stat-label {
    color: var(--gray);
    font-size: 0.875rem;
}

/* Table */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--light);
}

.table th {
    background: var(--light);
    font-weight: 600;
}

/* Data table - variante */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--light);
}

.data-table th {
    background: var(--light);
    font-weight: 600;
}

.data-table tr:hover {
    background: rgba(var(--primary-rgb), 0.05);
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 4px;
}

.badge-success { background: var(--success); color: white; }
.badge-warning { background: var(--warning); color: var(--dark); }
.badge-danger { background: var(--danger); color: white; }
.badge-info { background: var(--info); color: white; }
.badge-primary { background: var(--primary); color: white; }

/* =============================================================================
   Focus states - Style MCPL
   ============================================================================= */

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.1);
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
textarea:focus,
select:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.1);
}

/* =============================================================================
   Responsive
   ============================================================================= */

@media (max-width: 768px) {
    .menu-toggle {
        display: block;
    }

    .admin-header-inner {
        flex-wrap: wrap;
    }

    .admin-nav {
        display: none;
        width: 100%;
        flex-direction: column;
        gap: 0.25rem;
        margin-top: 0.5rem;
        padding-top: 0.5rem;
        border-top: 1px solid rgba(255,255,255,0.2);
    }

    .admin-nav.open {
        display: flex;
    }

    .admin-nav a {
        padding: 0.75rem 1rem;
        text-align: center;
        background: rgba(255,255,255,0.05);
    }

    /* Dropdown mobile */
    .nav-dropdown {
        width: 100%;
    }

    .nav-dropdown-toggle {
        width: 100%;
        text-align: center;
    }

    .nav-dropdown-menu {
        position: static;
        box-shadow: none;
        background: rgba(255,255,255,0.1);
        margin-top: 0;
        padding: 0;
    }

    .nav-dropdown-menu a {
        color: rgba(255,255,255,0.8) !important;
        padding: 0.75rem 1rem;
        padding-left: 2rem;
    }

    .nav-dropdown-menu a:hover {
        background: rgba(255,255,255,0.1) !important;
        color: white !important;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .table-responsive {
        overflow-x: auto;
    }
}

/* Header joueur responsive - mode portrait mobile */
@media (max-width: 480px) {
    .app-logo {
        font-size: 1.2rem;
    }

    .header-info-row {
        gap: 0.4rem;
    }

    .player-points,
    .player-timer {
        padding: 0.3rem 0.6rem;
        font-size: 0.8rem;
    }

    .btn-rules,
    .btn-quit {
        padding: 0.3rem 0.6rem;
        font-size: 0.75rem;
    }
}

/* PWA styles */
@media (display-mode: standalone) {
    body {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* =============================================================================
   Lightbox pour les photos (zoom, telecharger)
   ============================================================================= */

.lightbox-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.lightbox-overlay.active {
    display: flex;
}

.lightbox-container {
    position: relative;
    max-width: 95vw;
    max-height: 85vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.lightbox-image {
    max-width: 100%;
    max-height: 85vh;
    object-fit: contain;
    transition: transform 0.3s ease;
    cursor: grab;
    touch-action: none;
}

.lightbox-image.zoomed {
    cursor: grabbing;
    max-width: none;
    max-height: none;
}

.lightbox-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.4);
}

.lightbox-controls {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    z-index: 10001;
}

.lightbox-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 25px;
    font-size: 0.95rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.2s;
}

.lightbox-btn:hover {
    background: rgba(255, 255, 255, 0.4);
}

.lightbox-btn:active {
    background: rgba(255, 255, 255, 0.5);
}

.lightbox-caption {
    color: white;
    text-align: center;
    padding: 15px;
    font-size: 0.95rem;
    max-width: 90%;
}

/* Photo cliquable */
.stage-photo-clickable {
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stage-photo-clickable:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.stage-photo-clickable:active {
    transform: scale(0.98);
}

.photo-hint {
    text-align: center;
    color: #666;
    font-size: 0.8rem;
    margin-top: 0.5rem;
}

/* =============================================================================
   CAMERA PLEIN ECRAN - Overlay de capture photo
   ============================================================================= */

.camera-fullscreen-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    z-index: 10000;
    flex-direction: column;
}

.camera-fullscreen-overlay.active {
    display: flex;
}

.camera-fullscreen-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    flex-shrink: 0;
}

.camera-fullscreen-header span {
    font-weight: 600;
    font-size: 1rem;
}

.camera-close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.camera-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.camera-fullscreen-video {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.camera-fullscreen-video video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.camera-error-msg {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(220, 53, 69, 0.9);
    color: white;
    padding: 1.5rem;
    border-radius: 12px;
    text-align: center;
    max-width: 90%;
}

.camera-fullscreen-actions {
    padding: 1.5rem;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    flex-shrink: 0;
}

.camera-capture-btn {
    background: var(--success);
    border: none;
    color: white;
    padding: 1rem 3rem;
    border-radius: 50px;
    font-size: 1.25rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: transform 0.2s, background 0.2s;
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.4);
}

.camera-capture-btn:hover {
    background: #218838;
    transform: scale(1.05);
}

.camera-capture-btn:active {
    transform: scale(0.95);
}

.camera-capture-btn .capture-icon {
    font-size: 1.5rem;
}

/* Adaptation pour petits ecrans */
@media (max-height: 500px) {
    .camera-fullscreen-header {
        padding: 0.5rem 1rem;
    }

    .camera-fullscreen-actions {
        padding: 1rem;
    }

    .camera-capture-btn {
        padding: 0.75rem 2rem;
        font-size: 1rem;
    }
}

/* =============================================================================
   Google Maps Embed (iframe responsive)
   ============================================================================= */

.map-embed iframe {
    width: 100%;
    height: 300px;
    border: 0;
    display: block;
}

@media (min-width: 768px) {
    .map-embed iframe {
        height: 400px;
    }
}

/* =============================================================================
   INTERFACE JOUEUR - AMELIORATIONS MOBILE-FIRST
   ============================================================================= */

/* Header joueur compact et moderne */
.app-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    padding: 0.5rem 1rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.app-header-inner {
    max-width: 600px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Header rows */
.header-row {
    display: flex;
    justify-content: center;
    align-items: center;
}

.header-title-row {
    padding-bottom: 0.25rem;
    border-bottom: 1px solid rgba(255,255,255,0.2);
}

.header-info-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: nowrap;
    padding-top: 0.25rem;
}

.app-logo {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--white);
    font-size: 1.4rem;
    font-weight: 700;
    text-decoration: none;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
    letter-spacing: 0.5px;
}

.app-logo:hover {
    color: var(--white);
    text-decoration: none;
}

.app-logo-img {
    height: 30px;
    width: auto;
    border-radius: 6px;
    display: block;
    flex-shrink: 0;
}

.app-logo-emoji { font-size: 1.4rem; line-height: 1; }
.app-logo-text { line-height: 1; }

/* Points et Timer dans le header */
.player-points {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #78350f;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.3rem 0.5rem;
    border-radius: 15px;
    box-shadow: 0 2px 8px rgba(251, 191, 36, 0.4);
    white-space: nowrap;
    min-width: 55px;
    text-align: center;
}

.player-timer {
    background: rgba(0,0,0,0.3);
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.3rem 0.5rem;
    border-radius: 15px;
    font-family: 'Courier New', monospace;
    min-width: 65px;
    text-align: center;
    white-space: nowrap;
}

/* Boutons du header */
.btn-rules {
    background: rgba(255,255,255,0.2);
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
    padding: 0.3rem 0.5rem;
    font-size: 0.7rem;
    border-radius: 15px;
    text-decoration: none;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-rules:hover {
    background: rgba(255,255,255,0.35);
    color: white;
    transform: translateY(-1px);
}

.btn-quit {
    background: rgba(239, 68, 68, 0.8);
    color: white;
    border: 1px solid rgba(239, 68, 68, 0.9);
    padding: 0.3rem 0.5rem;
    font-size: 0.7rem;
    border-radius: 15px;
    text-decoration: none;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-quit:hover {
    background: rgba(220, 38, 38, 1);
    color: white;
    transform: translateY(-1px);
}

/* Container joueur plus large sur mobile */
.container {
    max-width: 600px;
    padding: 0.75rem;
}

/* Stage card améliorée */
.stage-card {
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    overflow: visible;
    margin-bottom: 1.5rem;
}

.stage-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    padding: 1.25rem;
    border-radius: 16px 16px 0 0;
}

.stage-number {
    background: rgba(255,255,255,0.25);
    padding: 0.4rem 1rem;
    border-radius: 25px;
    font-weight: 700;
    font-size: 0.9rem;
}

.stage-status {
    font-size: 1rem;
    font-weight: 500;
}

.stage-body {
    padding: 0;
}

/* Tabs améliorés - Plus gros et tactiles */
.phase-tabs {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
    border-bottom: none;
    background: #f8f9fa;
    margin-bottom: 0;
    padding: 0.5rem;
}

.phase-tab {
    padding: 1rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 12px;
    margin: 0.25rem;
    border-bottom: none;
    background: transparent;
    color: var(--gray);
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    min-height: 60px;
}

.phase-tab:active {
    transform: scale(0.95);
}

.phase-tab.active {
    background: var(--white);
    color: var(--primary);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Contenu des phases */
.phase-content {
    padding: 1.25rem;
}

/* Directions améliorées */
.directions-box {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    padding: 1.25rem;
    border-radius: 12px;
    border: 1px solid #bae6fd;
}

.directions-box h4 {
    color: #0369a1;
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
}

.directions-box p {
    color: #334155;
    line-height: 1.6;
    font-size: 1rem;
}

/* Boutons GPS plus gros */
.gps-button,
.btn-block {
    padding: 1rem 1.5rem;
    font-size: 1rem;
    border-radius: 12px;
    min-height: 52px;
}

/* Questions améliorées */
.question-item {
    background: var(--white);
    padding: 1.25rem;
    border-radius: 12px;
    margin-bottom: 1rem;
    border: 2px solid #e5e7eb;
    transition: border-color 0.2s;
}

.question-item:focus-within {
    border-color: var(--primary);
}

.question-header {
    margin-bottom: 1rem;
}

.question-points {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
}

.question-text {
    font-size: 1.05rem;
    line-height: 1.5;
    color: #1f2937;
    margin-bottom: 1.25rem;
}

/* Inputs améliorés pour le tactile */
.question-input,
.form-control {
    width: 100%;
    padding: 1rem 1.25rem;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.2s;
    -webkit-appearance: none;
    appearance: none;
}

.question-input:focus,
.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(var(--primary-rgb), 0.1);
    outline: none;
}

/* Select amélioré */
select.form-control {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpolyline points='6,9 12,15 18,9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1.25rem;
    padding-right: 3rem;
}

/* Boutons plus gros et tactiles */
.btn {
    padding: 1rem 1.5rem;
    font-size: 1rem;
    border-radius: 12px;
    font-weight: 600;
    min-height: 52px;
    transition: all 0.2s ease;
}

.btn:active {
    transform: scale(0.98);
}

.btn-success {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
}

.btn-success:hover {
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark) 0%, #2d4a36 100%);
}

/* Status des réponses */
.question-status {
    padding: 0.75rem 1rem;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.question-status.correct {
    background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
    color: #15803d;
}

.question-status.incorrect {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #b91c1c;
}

.question-status.pending {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #92400e;
}

/* Réponse soumise */
.answer-text {
    background: #f3f4f6;
    padding: 1rem;
    border-radius: 10px;
    border-left: 4px solid var(--primary);
    margin-bottom: 0.75rem;
}

/* Photo de l'étape */
.stage-photo {
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* Section prise de photo */
.capture-section {
    text-align: center;
}

.capture-section h4 {
    color: var(--primary);
    font-size: 1.1rem;
}

.current-photo img {
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}

/* Alertes améliorées */
.alert {
    padding: 1.25rem;
    border-radius: 12px;
    font-size: 1rem;
}

.alert-success {
    background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
    border: 1px solid #86efac;
}

.alert-warning {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 1px solid #fcd34d;
}

.alert-info {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    border: 1px solid #93c5fd;
}

/* Message de félicitations */
.alert-success h3 {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
}

/* Bouton étape suivante */
.btn-next-stage {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1.25rem 2rem;
    font-size: 1.1rem;
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: white;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 700;
    box-shadow: 0 6px 20px rgba(34, 197, 94, 0.4);
    transition: all 0.3s ease;
}

.btn-next-stage:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(34, 197, 94, 0.5);
}

/* Pénalité countdown */
#penalty-alert {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 2px solid #f59e0b;
    border-radius: 12px;
    padding: 0.55rem 1rem;
}

/* =============================================================================
   RESPONSIVE MOBILE OPTIMISE
   ============================================================================= */

@media (max-width: 480px) {
    /* Header compact pour petits ecrans */
    .app-header {
        padding: 0.4rem 0.75rem;
    }

    .header-title-row {
        padding-bottom: 0.2rem;
    }

    .header-info-row {
        gap: 0.35rem;
        padding-top: 0.2rem;
    }

    .app-logo {
        font-size: 1.15rem;
    }

    .player-points,
    .player-timer {
        font-size: 0.75rem;
        padding: 0.3rem 0.5rem;
    }

    .btn-rules,
    .btn-quit {
        padding: 0.3rem 0.5rem;
        font-size: 0.7rem;
    }

    /* Container plein écran */
    .container {
        padding: 0.5rem;
    }

    /* Tabs empilés si nécessaire */
    .phase-tabs {
        padding: 0.35rem;
    }

    .phase-tab {
        padding: 0.6rem 0.25rem;
        font-size: 0.65rem;
        min-height: 50px;
        margin: 0.15rem;
    }

    /* Contenu */
    .phase-content {
        padding: 1rem;
    }

    .question-item {
        padding: 1rem;
    }

    .question-text {
        font-size: 1rem;
    }

    /* Boutons tactiles */
    .btn,
    .gps-button,
    .btn-block {
        padding: 0.9rem 1.25rem;
        font-size: 0.95rem;
        min-height: 48px;
    }

    .btn-sm {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
        min-height: auto;
    }
}

/* Très petits écrans */
@media (max-width: 360px) {
    /* Header tres compact pour tres petits ecrans */
    .app-logo {
        font-size: 1rem;
    }

    .header-info-row {
        gap: 0.25rem;
    }

    .player-points,
    .player-timer {
        font-size: 0.7rem;
        padding: 0.25rem 0.4rem;
    }

    .btn-rules,
    .btn-quit {
        padding: 0.25rem 0.4rem;
        font-size: 0.65rem;
    }

    .phase-tab {
        font-size: 0.6rem;
        padding: 0.5rem 0.2rem;
    }

    .stage-header {
        padding: 1rem;
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }

    .question-text {
        font-size: 0.95rem;
    }
}

/* Mode paysage mobile */
@media (max-height: 500px) and (orientation: landscape) {
    .app-header {
        padding: 0.3rem 1rem;
    }

    .app-header-inner {
        gap: 0.25rem;
    }

    .header-title-row {
        padding-bottom: 0.15rem;
    }

    .header-info-row {
        padding-top: 0.15rem;
        gap: 0.4rem;
    }

    .app-logo {
        font-size: 1.1rem;
    }

    .player-points,
    .player-timer {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
    }

    .btn-rules,
    .btn-quit {
        padding: 0.25rem 0.5rem;
        font-size: 0.7rem;
    }

    .stage-header {
        padding: 0.75rem 1rem;
    }

    .phase-tabs {
        padding: 0.25rem;
    }

    .phase-tab {
        min-height: 45px;
        padding: 0.5rem;
    }
}

/* =============================================================================
   BANNIERE DE PENALITE - Version discrete
   ============================================================================= */

.penalty-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border: 1px solid #f59e0b;
    border-radius: 8px;
    padding: 0.5rem 1rem;
    margin-bottom: 1rem;
    font-size: 0.85rem;
    color: #92400e;
}

.penalty-icon {
    font-size: 1rem;
}

.penalty-text {
    font-weight: 500;
}

#penalty-countdown {
    font-weight: 700;
    font-family: 'SF Mono', Monaco, monospace;
    background: rgba(0,0,0,0.1);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
}

/* =============================================================================
   APERCU PHOTO AMELIORE
   ============================================================================= */

.photo-preview-container {
    background: linear-gradient(135deg, #ecfdf5, #d1fae5);
    border: 2px solid #10b981;
    border-radius: 12px;
    padding: 1rem;
    margin-top: 0.5rem;
}

.photo-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.photo-preview-badge {
    background: #10b981;
    color: white;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
}

.btn-change-photo {
    background: transparent;
    border: 1px solid #10b981;
    color: #10b981;
    font-size: 0.8rem;
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-change-photo:hover {
    background: #10b981;
    color: white;
}

.photo-preview-img {
    width: 100%;
    max-height: 180px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 0.75rem;
}

.photo-submit-btn {
    font-size: 1.1rem;
    font-weight: 600;
    padding: 0.9rem 1.5rem;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
    animation: pulse-btn 2s infinite;
}

@keyframes pulse-btn {
    0%, 100% {
        box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
    }
    50% {
        box-shadow: 0 4px 20px rgba(16, 185, 129, 0.5);
    }
}

/* =============================================================================
   CARTE DE FELICITATIONS - FIN DE PARCOURS
   ============================================================================= */

.completion-card {
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 50%, #a7f3d0 100%);
    border: 2px solid #10b981;
    border-radius: 20px;
    padding: 2rem 1.5rem;
    text-align: center;
    box-shadow: 0 10px 40px rgba(16, 185, 129, 0.2);
    margin: 1rem 0;
}

.completion-icon {
    font-size: 4rem;
    margin-bottom: 0.5rem;
    animation: bounce-icon 1s ease infinite;
}

@keyframes bounce-icon {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.completion-title {
    font-size: 1.8rem;
    font-weight: 800;
    color: #065f46;
    margin: 0 0 0.5rem 0;
}

.completion-subtitle {
    font-size: 1rem;
    color: #047857;
    margin: 0 0 1.5rem 0;
}

.completion-stats {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    background: white;
    border-radius: 15px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: #065f46;
    font-family: 'SF Mono', Monaco, monospace;
}

.stat-label {
    font-size: 0.75rem;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 0.25rem;
}

.stat-divider {
    width: 1px;
    height: 40px;
    background: #d1d5db;
}

.completion-note {
    font-size: 0.85rem;
    color: #6b7280;
    margin: 0;
    font-style: italic;
}

/* =============================================================================
   Modal START - Lancement du chronomètre par le joueur
   ============================================================================= */

.start-timer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(var(--primary-rgb), 0.97) 0%, rgba(31, 41, 55, 0.98) 100%);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.start-timer-modal {
    background: white;
    border-radius: 20px;
    padding: 2.5rem 2rem;
    max-width: 380px;
    width: 100%;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: startModalAppear 0.4s ease-out;
}

@keyframes startModalAppear {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.start-timer-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    animation: flagWave 1s ease-in-out infinite;
}

@keyframes flagWave {
    0%, 100% { transform: rotate(-5deg); }
    50% { transform: rotate(5deg); }
}

.start-timer-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: #1f2937;
    margin: 0 0 0.5rem 0;
}

.start-timer-subtitle {
    font-size: 1.1rem;
    color: var(--primary);
    font-weight: 600;
    margin: 0 0 1rem 0;
}

.start-timer-info {
    font-size: 0.95rem;
    color: #4b5563;
    margin: 0;
    line-height: 1.6;
}

.start-timer-btn {
    display: block;
    width: 100%;
    max-width: 200px;
    margin: 0 auto;
    padding: 1.25rem 2rem;
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: 3px;
    color: white;
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    border: none;
    border-radius: 16px;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(34, 197, 94, 0.4);
    transition: all 0.2s ease;
    text-transform: uppercase;
}

.start-timer-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(34, 197, 94, 0.5);
}

.start-timer-btn:active {
    transform: translateY(0);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.4);
}

.start-timer-note {
    font-size: 0.8rem;
    color: #9ca3af;
    margin: 1.5rem 0 0 0;
}

.start-timer-quit {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    padding: 0.4rem 0.75rem;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    transition: all 0.2s ease;
    backdrop-filter: blur(4px);
}

.start-timer-quit:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* =============================================================================
   PARCOURS GUIDÉ JOUEUR (wizard) - v1.10.0
   Couleurs : chrome de marque via --primary (suit le thème), succès via --success
   ============================================================================= */

/* Carte de progression globale (themée) */
.progress-card {
    margin-bottom: 1rem;
    padding: 0.75rem 0.9rem;
    background: rgba(var(--primary-rgb), 0.07);
    border: 1px solid rgba(var(--primary-rgb), 0.22);
    border-radius: 10px;
}
.progress-card-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}
.progress-card-label { font-weight: 600; color: var(--primary); font-size: 0.9rem; }
.progress-card-count { color: var(--primary); font-size: 0.85rem; }
.progress-card-track {
    background: rgba(var(--primary-rgb), 0.15);
    border-radius: 5px;
    height: 8px;
    overflow: hidden;
}
.progress-card-fill {
    height: 100%;
    border-radius: 5px;
    background: linear-gradient(90deg, var(--primary-light), var(--primary));
    transition: width 0.5s cubic-bezier(.16, 1, .3, 1);
}

/* Stepper des 4 phases */
.wizard-steps {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    background: #f8f9fa;
    padding: 0.85rem 0.5rem 0.6rem;
}
.wstep {
    position: relative;
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    padding: 0;
    font-family: inherit;
    transition: transform 0.12s ease;
}
.wstep:active { transform: scale(0.96); }
.wstep:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 19px;
    left: 60%;
    width: 80%;
    height: 2px;
    background: #e2e5ea;
    z-index: 0;
}
.wstep.is-done:not(:last-child)::after { background: var(--primary-light); }
.wstep-dot {
    position: relative;
    z-index: 1;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #e8eaed;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    border: 2px solid transparent;
    transition: all 0.25s ease;
    filter: grayscale(0.4);
}
.wstep-lbl {
    font-size: 0.66rem;
    font-weight: 600;
    color: var(--gray);
    transition: color 0.25s ease;
}
.wstep.is-current .wstep-dot {
    background: var(--primary);
    border-color: rgba(var(--primary-rgb), 0.25);
    box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.4);
    transform: scale(1.08);
    filter: none;
}
.wstep.is-current .wstep-lbl { color: var(--primary); }
.wstep.is-done .wstep-dot {
    background: rgba(var(--primary-rgb), 0.14);
    filter: none;
}
.wstep.is-done:not(.is-current) .wstep-dot::after {
    content: '✓';
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 16px;
    height: 16px;
    background: var(--success);
    color: #fff;
    border-radius: 50%;
    font-size: 0.62rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--white);
}

/* Mini-splash de transition entre étapes (grammaire du splash d'accueil) */
.stage-transition {
    position: fixed;
    inset: 0;
    z-index: 9998;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #fff;
    opacity: 0;
    transition: opacity 0.45s ease;
}
.stage-transition.show { display: flex; opacity: 1; }
.stage-transition.is-hiding { opacity: 0; }
.stage-transition .st-num {
    font-size: 0.85rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    opacity: 0.85;
    animation: stFadeUp 0.5s ease both;
}
.stage-transition .st-title {
    font-size: 1.9rem;
    font-weight: 800;
    margin-top: 0.25rem;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
    animation: stFadeUp 0.5s ease 0.12s both;
}
.stage-transition .st-dots {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    animation: stFadeUp 0.5s ease 0.24s both;
}
.stage-transition .st-dots span {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    animation: stBounce 1s ease-in-out infinite;
}
.stage-transition .st-dots span:nth-child(2) { animation-delay: 0.15s; }
.stage-transition .st-dots span:nth-child(3) { animation-delay: 0.30s; }
@keyframes stFadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes stBounce { 0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; } 40% { transform: scale(1); opacity: 1; } }
body.no-scroll { overflow: hidden; }

/* Carte de fin : passe sur le dégradé du thème + confettis */
.completion-card {
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 55%, var(--primary-dark) 100%);
    border: none;
    color: #fff;
    position: relative;
    overflow: hidden;
    box-shadow: 0 12px 40px rgba(var(--primary-rgb), 0.35);
}
.completion-title { color: #fff; }
.completion-subtitle { color: rgba(255, 255, 255, 0.9); }
.completion-note { color: rgba(255, 255, 255, 0.85); }
.completion-card .stat-value { color: var(--primary); }
.completion-confetti {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}
.completion-card > *:not(.completion-confetti) {
    position: relative;
    z-index: 2;
}

/* =============================================================================
   RESPONSIVE MODE JOUEUR — garanties téléphone (wizard)
   ============================================================================= */

/* Anti-débordement horizontal : médias, iframes, code, mots/titres longs */
.phase-content img,
.stage-photo,
.directions-box img { max-width: 100%; height: auto; }
.map-embed,
.map-embed iframe { max-width: 100%; }
.directions-box p,
.question-text,
.answer-text { overflow-wrap: anywhere; }
.gps-coords code { word-break: break-all; }

/* Titre de marque : ne déborde jamais (ellipse si trop long) */
.app-logo { min-width: 0; max-width: 100%; }
.app-logo-text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Grand mobile / petite tablette */
@media (max-width: 480px) {
    .wizard-steps { padding: 0.7rem 0.35rem 0.5rem; }
    .wstep-dot { width: 34px; height: 34px; font-size: 0.95rem; }
    .wstep-lbl { font-size: 0.62rem; }
    .wstep:not(:last-child)::after { top: 17px; }
    .stage-transition .st-title { font-size: 1.6rem; }
}

/* Petits téléphones */
@media (max-width: 380px) {
    .app-logo-img { height: 24px; }
    .wstep-dot { width: 32px; height: 32px; font-size: 0.9rem; }
    .wstep-lbl { font-size: 0.58rem; letter-spacing: -0.2px; }
    .wstep:not(:last-child)::after { top: 16px; }
}

/* Très petits téléphones (≤360px) */
@media (max-width: 360px) {
    .header-info-row { gap: 0.25rem; }
    .player-points,
    .player-timer { min-width: 0; }
    .wstep-dot { width: 30px; height: 30px; font-size: 0.85rem; }
    .wstep-lbl { font-size: 0.55rem; }
    .wstep:not(:last-child)::after { top: 15px; left: 62%; width: 74%; }
    .wstep.is-done:not(.is-current) .wstep-dot::after { width: 14px; height: 14px; font-size: 0.55rem; }
    .completion-stats { gap: 0.75rem; padding: 1rem; }
    .completion-card .stat-value { font-size: 1.25rem; }
    .stage-transition .st-title { font-size: 1.5rem; }
}

@media (prefers-reduced-motion: reduce) {
    .stage-transition .st-num,
    .stage-transition .st-title,
    .stage-transition .st-dots,
    .stage-transition .st-dots span { animation: none; }
}

/* =============================================================================
   MODE JOUEUR — App-shell plein écran + carrousel balayable (v1.10.0)
   Objectif : aucune navigation au scroll. On change de phase par swipe / stepper.
   ============================================================================= */

/* Vue étape : la page ne défile pas, tout tient dans le viewport */
body.player-stage {
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
body.player-stage > .container {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding-bottom: 0;
}
body.player-stage .stage-card {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    margin-bottom: 0;
}
body.player-stage .stage-body {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 0;
}

/* Carrousel : prend toute la hauteur restante, défilement horizontal géré au swipe */
.phase-viewport {
    flex: 1 1 auto;
    min-height: 0;
    position: relative;
    overflow: hidden;
}
/* Chaque phase occupe tout le viewport ; défile en interne seulement si le contenu déborde */
body.player-stage .phase-content {
    position: absolute;
    inset: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 1.1rem 1.1rem 1.3rem;
}
body.player-stage .phase-content.active { display: block; }

/* Animations directionnelles lors du changement de phase */
.phase-content.slide-from-right { animation: phaseFromRight 0.28s ease; }
.phase-content.slide-from-left { animation: phaseFromLeft 0.28s ease; }
@keyframes phaseFromRight { from { opacity: 0; transform: translateX(28px); } to { opacity: 1; transform: none; } }
@keyframes phaseFromLeft { from { opacity: 0; transform: translateX(-28px); } to { opacity: 1; transform: none; } }

/* Indice de balayage (bas de la carte d'étape) */
.swipe-hint {
    flex: 0 0 auto;
    text-align: center;
    font-size: 0.72rem;
    color: var(--gray);
    padding: 0.3rem 0 calc(0.3rem + env(safe-area-inset-bottom));
    background: #f8f9fa;
    border-top: 1px solid #e8eaed;
    animation: swipeHintPulse 2.4s ease-in-out infinite;
}
@keyframes swipeHintPulse { 0%, 100% { opacity: 0.5; } 50% { opacity: 1; } }

/* Carte d'itinéraire plus basse en vue étape (limite le défilement interne) */
body.player-stage .map-embed iframe { height: 170px; }

@media (prefers-reduced-motion: reduce) {
    .phase-content.slide-from-right,
    .phase-content.slide-from-left { animation: none; }
    .swipe-hint { animation: none; opacity: 0.7; }
}

/* =============================================================================
   CAMÉRA — bascule principale/selfie + miroir
   ============================================================================= */
.camera-fullscreen-actions { position: relative; }
.camera-flip-btn {
    position: absolute;
    right: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.35);
    color: #fff;
    font-size: 1.4rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.camera-flip-btn:active { transform: translateY(-50%) scale(0.9); }
.camera-fullscreen-video video.mirrored { transform: scaleX(-1); }

/* =============================================================================
   VUE ÉTAPE — contenu compact (moins de défilement) + style "jeu" lisible
   Garde le code couleur de l'app (chrome = --primary, succès = --success)
   ============================================================================= */
body.player-stage .container { padding-top: 0.5rem; }
body.player-stage .stage-header { padding: 0.8rem 1rem; }
body.player-stage .progress-card { margin-bottom: 0.55rem; padding: 0.5rem 0.8rem; }
body.player-stage .progress-card-track { height: 7px; }

body.player-stage .phase-content { padding: 0.85rem 0.95rem 1rem; }
body.player-stage .phase-content h4 { font-size: 1.05rem; margin-bottom: 0.5rem; }
body.player-stage .directions-box { padding: 0.85rem; margin-bottom: 0.75rem; }
body.player-stage .directions-box p { font-size: 0.98rem; line-height: 1.45; }
body.player-stage .gps-coords { padding: 0.5rem 0.65rem !important; font-size: 0.8rem; margin: 0.6rem 0 !important; }
body.player-stage .stage-photo { max-height: 40vh; object-fit: cover; }
body.player-stage .photo-description,
body.player-stage .photo-hint { margin-top: 0.35rem; font-size: 0.8rem; }
body.player-stage .question-item { padding: 0.9rem; margin-bottom: 0.7rem; }
body.player-stage .question-text { margin-bottom: 0.7rem; font-size: 1.05rem; }
body.player-stage .capture-section h4 { margin-bottom: 0.6rem !important; }

/* Boutons "jeu" : gros, bien ronds, lisibles, réaction au tap.
   On EXCLUT .btn-sm (boutons Règles / Quitter de l'en-tête) pour qu'ils restent
   de la taille des pastilles Points/Chrono -> en-tête compact, + de place au quiz. */
body.player-stage .btn:not(.btn-sm),
body.player-stage .gps-button,
body.player-stage .btn-block {
    min-height: 52px;
    border-radius: 18px;
    font-weight: 800;
    font-size: 1rem;
    letter-spacing: 0.2px;
}
body.player-stage .btn:active { transform: scale(0.95); }

/* En-tête : Règles / Quitter alignés sur la taille des pastilles */
body.player-stage .btn-rules,
body.player-stage .btn-quit {
    min-height: 0;
    padding: 0.3rem 0.5rem;
    font-size: 0.72rem;
    border-radius: 15px;
    font-weight: 700;
}

/* Stepper plus joueur : pastille courante qui "respire" */
body.player-stage .wizard-steps { padding: 0.45rem 0.5rem 0.35rem; }
body.player-stage .wstep.is-current .wstep-dot { animation: wstepBreathe 1.8s ease-in-out infinite; }
@keyframes wstepBreathe { 0%, 100% { transform: scale(1.08); } 50% { transform: scale(1.18); } }

/* Indice de swipe plus visible et ludique */
.swipe-hint { font-weight: 700; color: var(--primary); letter-spacing: 0.3px; }

@media (prefers-reduced-motion: reduce) {
    body.player-stage .wstep.is-current .wstep-dot { animation: none; }
}

/* =============================================================================
   STYLE JEU "CARTOON" + MASCOTTE AUTO « Turbo » (v1.10.0)
   Scopé à body.roadbook-game pour ne pas toucher login / tutoriel / règles.
   Garde le code couleur : --primary (thème), --success pour le succès.
   ============================================================================= */
body.roadbook-game {
    font-family: 'Baloo 2', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
body.roadbook-game button,
body.roadbook-game input,
body.roadbook-game select,
body.roadbook-game textarea { font-family: inherit; }

/* --- Barre mascotte (remplace l'en-tête d'étape) --- */
body.roadbook-game .stage-header.mascot-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
}
.mascot-car {
    font-size: 2.4rem;
    flex-shrink: 0;
    line-height: 1;
    transform-origin: 60% 80%;
    animation: turboVroom 1.8s ease-in-out infinite;
}
@keyframes turboVroom {
    0%, 100% { transform: translateX(0) rotate(-2deg); }
    25% { transform: translateX(3px) rotate(1deg); }
    50% { transform: translateX(0) rotate(-1deg); }
    75% { transform: translateX(-2px) rotate(2deg); }
}
.mascot-speech {
    position: relative;
    flex: 1;
    min-width: 0;
    background: #fff;
    color: #33473b;
    border-radius: 14px;
    padding: 8px 12px;
    font-size: 0.92rem;
    font-weight: 700;
    line-height: 1.3;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.18);
}
.mascot-speech::before {
    content: '';
    position: absolute;
    left: -7px;
    top: 14px;
    border: 6px solid transparent;
    border-right-color: #fff;
}
.mascot-speech b { color: var(--primary); }

/* --- Boutons "jeu" 3D --- */
body.roadbook-game .btn { border-radius: 20px; font-weight: 800; }
body.roadbook-game .btn-primary {
    background: var(--primary);
    box-shadow: 0 6px 0 var(--primary-dark);
}
body.roadbook-game .btn-primary:active {
    transform: translateY(4px);
    box-shadow: 0 2px 0 var(--primary-dark);
}
body.roadbook-game .btn-success {
    background: var(--success);
    box-shadow: 0 6px 0 #1f9e3f;
}
body.roadbook-game .btn-success:active {
    transform: translateY(4px);
    box-shadow: 0 2px 0 #1f9e3f;
}

/* --- Stepper "jeu" : pastilles arrondies + relief --- */
body.roadbook-game .wstep-dot {
    border-radius: 16px;
    box-shadow: 0 3px 0 #cfe0d4;
}
body.roadbook-game .wstep.is-current .wstep-dot {
    border-radius: 16px;
    box-shadow: 0 5px 0 var(--primary-dark);
}
body.roadbook-game .wstep.is-done .wstep-dot {
    background: var(--success);
    color: #fff;
    box-shadow: 0 3px 0 #1f9e3f;
}
body.roadbook-game .wstep.is-done .wstep-dot::after { display: none; }

/* --- Récompense bonne réponse --- */
body.roadbook-game .question-status.correct { animation: turboTada 0.6s; }
@keyframes turboTada {
    0% { transform: scale(1); }
    30% { transform: scale(1.06) rotate(-2deg); }
    60% { transform: scale(1.03) rotate(2deg); }
    100% { transform: scale(1); }
}

/* --- Petit drapeau d'arrivée sur la progression --- */
body.roadbook-game .progress-card-label::before { content: '🏁 '; }

@media (prefers-reduced-motion: reduce) {
    .mascot-car { animation: none; }
    body.roadbook-game .question-status.correct { animation: none; }
}

/* =============================================================================
   INVITE AU RETOUR DE WAZE / MAPS (Turbo guide vers la photo)
   ============================================================================= */
.nav-return-overlay {
    position: fixed;
    inset: 0;
    z-index: 10001;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: rgba(20, 30, 24, 0.6);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
}
.nav-return-overlay.show { display: flex; animation: navReturnFade 0.25s ease; }
@keyframes navReturnFade { from { opacity: 0; } to { opacity: 1; } }
.nav-return-card {
    background: #fff;
    border-radius: 24px;
    padding: 1.75rem 1.5rem 1.5rem;
    max-width: 340px;
    width: 100%;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
    animation: navReturnPop 0.35s cubic-bezier(.18, 1.3, .5, 1);
}
@keyframes navReturnPop { from { transform: scale(.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.nav-return-car {
    font-size: 3.4rem;
    line-height: 1;
    transform-origin: 60% 80%;
    animation: turboVroom 1.8s ease-in-out infinite;
}
.nav-return-title { font-size: 1.6rem; font-weight: 800; color: var(--primary); margin: 0.3rem 0 0.4rem; }
.nav-return-text { font-size: 1rem; color: #44524a; margin-bottom: 1.25rem; line-height: 1.45; }
.nav-return-skip {
    display: block;
    margin: 0.7rem auto 0;
    background: none;
    border: none;
    color: var(--gray);
    font-size: 0.92rem;
    font-weight: 700;
    text-decoration: underline;
    cursor: pointer;
    font-family: inherit;
}

@media (prefers-reduced-motion: reduce) {
    .nav-return-overlay.show,
    .nav-return-card,
    .nav-return-car { animation: none; }
}

/* =============================================================================
   QUIZ PAS-À-PAS : une question à la fois, réponses tactiles, zéro scroll
   ============================================================================= */
.quiz-progress {
    text-align: center;
    font-weight: 800;
    color: var(--primary);
    font-size: 0.9rem;
    margin-bottom: 0.7rem;
}
.question-solo .question-text {
    font-size: 1.2rem;
    font-weight: 700;
    line-height: 1.35;
}
/* Réponses à choix : gros boutons tactiles (1 tap = validé) */
.choices-grid { display: flex; flex-direction: column; gap: 0.6rem; margin-top: 0.3rem; }
.btn-choice {
    width: 100%;
    padding: 1rem 1.1rem;
    border: 3px solid #e3e8e4;
    border-radius: 16px;
    background: #fff;
    color: var(--dark);
    font-size: 1.15rem;
    font-weight: 700;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    box-shadow: 0 4px 0 #e3e8e4;
    transition: transform 0.1s, border-color 0.15s, box-shadow 0.1s;
}
.btn-choice:hover { border-color: var(--primary-light); }
.btn-choice:active { transform: translateY(3px); box-shadow: 0 1px 0 #e3e8e4; }
.btn-choice.sel {
    border-color: var(--primary);
    background: rgba(var(--primary-rgb), 0.08);
    color: var(--primary);
    box-shadow: 0 4px 0 var(--primary);
}
.choices-hint { text-align: center; color: var(--gray); font-size: 0.85rem; font-weight: 700; margin-top: 0.7rem; }
body.roadbook-game .btn:disabled { opacity: 0.5; box-shadow: none; cursor: not-allowed; transform: none; }

/* Écrans d'attente / fin de quiz */
.quiz-wait {
    margin-top: 1rem;
    padding: 1rem;
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border: 2px solid var(--warning);
    border-radius: 14px;
    color: #92400e;
    font-weight: 700;
    text-align: center;
}
.quiz-done-msg {
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(40, 167, 69, 0.12);
    border-radius: 14px;
    color: #166534;
    font-weight: 800;
    text-align: center;
}
.quiz-done-panel { text-align: center; padding: 1.5rem 1rem; }
.quiz-done-panel p { color: #166534; font-weight: 800; font-size: 1.1rem; margin-bottom: 1rem; }

/* =============================================================================
   QUIZ COMPACT — une question tient à l'écran (flux naturel + tailles fluides)
   Pas de distribution forcée (évite tout chevauchement). Une seule question à
   l'écran -> tient sans scroll sur un téléphone normal ; défilement interne
   seulement en ultime filet de sécurité (très petit écran + question longue).
   ============================================================================= */
.phase-quiz .quiz-progress { margin-bottom: 0.4rem; }
.phase-quiz .question-solo { margin-bottom: 0; }
.phase-quiz .question-header { margin-bottom: 0.4rem; }
.phase-quiz .question-text {
    font-size: clamp(1rem, 4vw, 1.2rem);
    line-height: 1.3;
    margin-bottom: 0.6rem;
}
.phase-quiz .choices-grid { gap: clamp(0.4rem, 1.3vh, 0.6rem); margin: 0.3rem 0; }
.phase-quiz .btn-choice {
    font-size: clamp(0.95rem, 3.6vw, 1.15rem);
    padding: clamp(0.55rem, 1.5vh, 0.9rem) 1rem;
    line-height: 1.25;
}
.phase-quiz .choices-hint { margin: 0.4rem 0; }
.phase-quiz .photo-preview-img { max-height: 26vh; }
