/* =============================================================================
   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;
}

/* =============================================================================
   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 {
    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;
}

/* 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: 16px;
    padding: 1.5rem;
}

/* =============================================================================
   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);
}
