* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #a8d5d0;
    background-image:
        repeating-linear-gradient(0deg, transparent, transparent 79px, #7db5af 79px, #7db5af 81px),
        repeating-linear-gradient(90deg, transparent, transparent 79px, #7db5af 79px, #7db5af 81px);
    background-size: 80px 80px;
    height: 100vh;
    padding: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.page {
    display: none;
    max-width: 1400px;
    width: 100%;
    max-height: 100vh;
}

.page.active {
    display: block;
}

/* Header de mission */
.mission-container {
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    max-width: 1200px;
    margin: 0 auto;
    border: 3px solid #5e9b95;
}

.mission-header {
    background: #f8f8f8;
    padding: 10px 25px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 2px solid #e0e0e0;
}

.mission-header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.nike-logo-header {
    width: 50px;
    height: auto;
}

.mission-title {
    font-size: 1.1em;
    color: #5e9b95;
    font-weight: 600;
    margin: 0;
}

.menu-btn {
    width: 40px;
    height: 40px;
    background: #4a4a7f;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    transition: all 0.3s ease;
}

.menu-btn:hover {
    background: #5a5a8f;
}

.menu-btn span {
    width: 20px;
    height: 2px;
    background: white;
    border-radius: 2px;
}

/* Contenu principal */
.content-area {
    background: white;
    padding: 10px 20px;
    min-height: 220px;
    max-height: 520px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.question-title {
    font-size: 1.3em;
    color: #4a4a7f;
    text-align: center;
    margin-bottom: 25px;
    font-weight: 600;
}

/* Lien vidéo pour mission 2 */
.video-link {
    margin-bottom: 20px;
    text-align: center;
}

.video-link a {
    color: #5e9b95;
    text-decoration: none;
    font-size: 0.9em;
    font-weight: 600;
    padding: 8px 20px;
    border: 2px solid #5e9b95;
    border-radius: 25px;
    display: inline-block;
    transition: all 0.3s ease;
}

.video-link a:hover {
    background: #5e9b95;
    color: white;
}

/* Réponses style QCM */
.answers-container {
    display: flex;
    gap: 12px;
    margin-bottom: 25px;
    flex-wrap: wrap;
    justify-content: center;
}

.answer-btn {
    background: #4a4a7f;
    color: white;
    padding: 16px 30px;
    border: none;
    border-radius: 8px;
    font-size: 0.9em;
    cursor: pointer;
    min-width: 280px;
    text-align: center;
    transition: all 0.3s ease;
    box-shadow: 0 3px 10px rgba(74, 74, 127, 0.3);
    position: relative;
    border: 3px solid transparent;
}

.answer-btn:hover {
    background: #5a5a8f;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(74, 74, 127, 0.4);
}

.answer-btn.selected {
    background: #5e9b95;
    border: 3px solid #3d7a75;
    transform: scale(1.05);
    box-shadow: 0 0 0 4px rgba(94, 155, 149, 0.3);
}

.answer-btn.correct::before {
    content: '✓';
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #5cb85c;
    font-size: 1.8em;
    font-weight: bold;
}

.answer-btn.incorrect::before {
    content: '✗';
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #ff6b6b;
    font-size: 1.8em;
    font-weight: bold;
}

.answer-btn.disabled {
    pointer-events: none;
}

/* Image pour mission 4 */
.answer-with-image {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.answer-image-placeholder {
    width: 100%;
    height: 80px;
    background: #f0f0f0;
    border: 2px dashed #ccc;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    font-size: 0.75em;
    margin-bottom: 5px;
}

/* Drag and Drop */
.drag-container {
    display: flex;
    gap: 20px;
    width: 100%;
    max-width: 1100px;
    margin-bottom: 25px;
    align-items: flex-start;
}

.drop-zone-container {
    flex: 1;
    background: #e5e5ea;
    border-radius: 10px;
    padding: 15px;
    min-height: 280px;
}

.drop-zone-title {
    font-size: 0.95em;
    font-weight: 600;
    color: #000;
    margin-bottom: 12px;
    text-align: center;
}

.drop-area {
    min-height: 200px;
}

.items-pool {
    flex: 0 0 320px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: stretch;
    justify-content: center;
}

.draggable-item {
    background: #4a4a7f;
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: grab;
    text-align: center;
    font-size: 0.85em;
    transition: all 0.3s ease;
    box-shadow: 0 3px 10px rgba(74, 74, 127, 0.3);
    user-select: none;
}

.draggable-item:hover {
    background: #5a5a8f;
    transform: scale(1.02);
    box-shadow: 0 5px 15px rgba(74, 74, 127, 0.4);
}

.draggable-item:active {
    cursor: grabbing;
}

.draggable-item.dragging {
    opacity: 0.5;
}

.draggable-item.placed {
    background: #5e9b95;
    cursor: pointer;
}

.draggable-item.correct-drop {
    background: #5cb85c;
    color: white;
}

.draggable-item.incorrect-drop {
    background: #ff6b6b;
    color: white;
}

.drop-placeholder {
    min-height: 50px;
    border: 2px dashed #999;
    border-radius: 6px;
    margin: 6px 0;
    transition: all 0.3s ease;
}

.drop-placeholder.drag-over {
    background: rgba(94, 155, 149, 0.2);
    border-color: #5e9b95;
}

/* Tri */
.sorting-container {
    width: 100%;
    max-width: 700px;
    margin-bottom: 25px;
}

.sorting-items {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sorting-item {
    background: #4a4a7f;
    color: white;
    padding: 15px 25px;
    border-radius: 8px;
    cursor: grab;
    text-align: center;
    font-size: 0.9em;
    transition: all 0.3s ease;
    box-shadow: 0 3px 10px rgba(74, 74, 127, 0.3);
    user-select: none;
    display: flex;
    align-items: center;
    gap: 15px;
}

.sorting-number {
    background: rgba(255, 255, 255, 0.2);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    flex-shrink: 0;
}

.sorting-text {
    flex: 1;
    text-align: left;
}

.sorting-item:hover {
    background: #5a5a8f;
    transform: scale(1.02);
    box-shadow: 0 5px 15px rgba(74, 74, 127, 0.4);
}

.sorting-item:active {
    cursor: grabbing;
}

.sorting-item.dragging {
    opacity: 0.5;
}

.sorting-item.correct-order {
    background: #5cb85c;
    cursor: default;
}

.sorting-item.incorrect-order {
    background: #ff6b6b;
    cursor: default;
}

/* Boutons d'action */
.action-btn {
    background: #5e9b95;
    color: white;
    padding: 10px 50px;
    border: none;
    border-radius: 25px;
    font-size: 0.95em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(94, 155, 149, 0.3);
}

.action-btn:hover {
    background: #4e8b85;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(94, 155, 149, 0.4);
}

.btn-secondary {
    background: white;
    color: #5e9b95;
    border: 2px solid #5e9b95;
    padding: 8px 30px;
    border-radius: 25px;
    font-size: 0.85em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: #5e9b95;
    color: white;
}

.buttons-container {
    display: flex;
    gap: 10px;
    margin-top: 12px;
}

/* Page d'accueil */
.home-page {
    background: white;
    padding: 40px 60px;
    border-radius: 15px;
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}

.home-logo {
    width: 100px;
    margin-bottom: 20px;
}

.home-title {
    font-size: 1em;
    color: #4a4a7f;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 15px;
}

.home-subtitle {
    font-size: 2.5em;
    font-weight: 300;
    color: #000;
    line-height: 1.2;
    margin-bottom: 35px;
}

.home-start-btn {
    background: #4a4a7f;
    color: white;
    padding: 15px 50px;
    border: none;
    border-radius: 8px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(74, 74, 127, 0.3);
}

.home-start-btn:hover {
    background: #5a5a8f;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(74, 74, 127, 0.4);
}

/* Menu des missions */
.missions-menu {
    background: white;
    padding: 35px 40px;
    border-radius: 15px;
    max-width: 950px;
    margin: 0 auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    border: 3px solid #5e9b95;
}

.menu-header {
    text-align: center;
    margin-bottom: 25px;
}

.menu-logo {
    width: 60px;
    margin-bottom: 12px;
}

.menu-main-title {
    font-size: 1.6em;
    color: #4a4a7f;
    font-weight: 600;
    margin-bottom: 8px;
}

.menu-subtitle {
    font-size: 1.1em;
    color: #5e9b95;
    margin-bottom: 12px;
}

.progress-info {
    font-size: 0.9em;
    color: #666;
    margin-top: 6px;
}

.missions-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.mission-card {
    background: #f5f5f5;
    border: 3px solid #5e9b95;
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    position: relative;
    min-height: 140px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.mission-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(94, 155, 149, 0.3);
    border-color: #4a4a7f;
}

.mission-card.locked {
    opacity: 0.5;
    cursor: not-allowed;
    background: #e8e8e8;
    border-color: #ccc;
}

.mission-card.locked:hover {
    transform: none;
    box-shadow: none;
}

.mission-card.completed {
    background: #d4edda;
    border-color: #5cb85c;
}

.mission-number {
    font-size: 2em;
    font-weight: bold;
    color: #4a4a7f;
    margin-bottom: 8px;
}

.mission-name {
    font-size: 0.95em;
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}

.mission-desc {
    font-size: 0.8em;
    color: #666;
}

.mission-card.locked::before {
    content: '🔒';
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 1.3em;
}

.mission-card.completed::after {
    content: '✓';
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 1.6em;
    color: #5cb85c;
}

/* Modal de feedback */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(168, 213, 208, 0.95);
    justify-content: center;
    align-items: center;
    z-index: 2000;
    backdrop-filter: blur(10px);
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    max-width: 450px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-icon {
    font-size: 4em;
    margin-bottom: 15px;
}

.modal-title {
    font-size: 1.6em;
    color: #4a4a7f;
    margin-bottom: 15px;
    font-weight: 600;
}

.modal-message {
    font-size: 1.05em;
    color: #666;
    margin-bottom: 25px;
    line-height: 1.5;
}

/* Page de score final */
.final-score-page {
    background: white;
    padding: 25px 35px;
    border-radius: 15px;
    max-width: 550px;
    margin: 0 auto;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    border: 3px solid #5e9b95;
}

.final-score-display {
    font-size: 3em;
    font-weight: bold;
    color: #5e9b95;
    margin: 12px 0;
}

.final-score-display.failed {
    color: #ff6b6b;
}

.final-message {
    font-size: 0.95em;
    color: #666;
    margin-bottom: 18px;
    line-height: 1.4;
}

/* Certificat */
.certificate-page {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    padding: 15px;
    border-radius: 0;
    max-width: 600px;
    margin: 0 auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.certificate {
    background: white;
    border: 8px solid #4a4a7f;
    border-image: linear-gradient(135deg, #4a4a7f 0%, #5e9b95 100%) 1;
    padding: 25px 20px;
    text-align: center;
    position: relative;
    box-shadow: inset 0 0 0 5px white, inset 0 0 0 7px #d4af37;
}

.certificate::before,
.certificate::after {
    content: '';
    position: absolute;
    width: 50px;
    height: 50px;
    border: 2px solid #d4af37;
}

.certificate::before {
    top: 10px;
    left: 10px;
    border-right: none;
    border-bottom: none;
}

.certificate::after {
    bottom: 10px;
    right: 10px;
    border-left: none;
    border-top: none;
}

.certificate h1 {
    font-size: 0.95em;
    color: #4a4a7f;
    margin-bottom: 5px;
    letter-spacing: 4px;
    font-weight: 700;
    text-transform: uppercase;
}

.certificate-logo {
    width: 50px;
    height: auto;
    margin: 8px auto;
}

.certificate-name {
    font-size: 1.5em;
    font-weight: 700;
    color: #2c3e50;
    margin: 12px 0;
    font-family: 'Georgia', serif;
    border-bottom: 2px solid #d4af37;
    padding-bottom: 8px;
    display: inline-block;
}

.certificate-subtitle {
    font-size: 0.8em;
    color: #5e9b95;
    margin-bottom: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.certificate-score {
    font-size: 1.6em;
    font-weight: bold;
    color: #d4af37;
    margin: 12px 0;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.certificate-seal {
    width: 60px;
    height: 60px;
    margin: 12px auto;
    position: relative;
}

.certificate-date {
    font-size: 0.75em;
    color: #666;
    margin-top: 12px;
    font-style: italic;
}

.certificate-signature {
    margin-top: 15px;
    display: flex;
    justify-content: space-around;
    align-items: flex-end;
}

.signature-block {
    text-align: center;
    min-width: 140px;
}

.signature-line {
    border-top: 1px solid #333;
    margin-bottom: 5px;
    width: 120px;
    margin-left: auto;
    margin-right: auto;
}

.signature-text {
    font-size: 0.7em;
    color: #666;
    font-weight: 600;
}

/* Modal nom */
.name-input-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(168, 213, 208, 0.95);
    justify-content: center;
    align-items: center;
    z-index: 3000;
    backdrop-filter: blur(10px);
}

.name-input-modal.active {
    display: flex;
}

.name-input-content {
    background: white;
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    max-width: 450px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.name-input-content h2 {
    color: #4a4a7f;
    margin-bottom: 15px;
}

.name-input-content input {
    width: 100%;
    padding: 12px;
    margin: 20px 0;
    border: 2px solid #5e9b95;
    border-radius: 8px;
    font-size: 1em;
    text-align: center;
}

.powered-by {
    text-align: center;
    font-size: 0.75em;
    color: #999;
    margin-top: 18px;
}

/* Media queries */
@media (max-width: 768px) {
    .missions-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Print styles */
@media print {
    @page {
        size: A4 portrait;
        margin: 1cm;
    }

    body {
        background: white;
        margin: 0;
        padding: 0;
        height: auto;
    }

    .page {
        display: none !important;
    }

    #certificate {
        display: block !important;
        max-height: none;
        overflow: visible;
    }

    .certificate-page {
        max-width: 100%;
        width: 100%;
        padding: 15px;
        margin: 0;
        box-shadow: none;
        border: none;
        page-break-inside: avoid;
        page-break-after: avoid;
    }

    .certificate {
        padding: 15px;
        page-break-inside: avoid;
    }

    .certificate h1 {
        font-size: 0.95em;
        margin-bottom: 10px;
    }

    .certificate-name {
        font-size: 1.5em;
        margin: 10px 0;
    }

    .certificate-subtitle {
        font-size: 0.85em;
        margin-bottom: 10px;
    }

    .certificate-score {
        font-size: 1.6em;
        margin: 15px 0;
    }

    .certificate-medal {
        width: 120px;
        margin: 10px 0;
    }

    .buttons-container,
    .powered-by {
        display: none !important;
    }
}