/* --- Réinitialisation des styles --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Arial", sans-serif;
}

body {
    background-color: #111; /* Fond noir */
    color: white;
    line-height: 1.6;
    min-height: 100vh;
}

body.subpage {
    padding-top: 0;
}

/* --- HEADER / NAVIGATION --- */
.header, #header {
    background: #222; /* Gris foncé */
    padding: 15px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.header.scrolled, #header.scrolled {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

/* Header caché au scroll sur mobile */
.header.header-hidden, #header.header-hidden {
    transform: translateY(-100%);
}

.header .logo, #header h1 a {
    font-size: 22px;
    font-weight: bold;
    color: white;
    text-decoration: none;
}

.header nav ul, #menu ul {
    list-style: none;
    display: flex;
}

.header nav ul li, #menu ul li {
    margin: 0 15px;
}

.header nav ul li a, #menu ul li a {
    text-decoration: none;
    color: #aaa;
    font-size: 16px;
    transition: color 0.3s;
}

.header nav ul li a:hover, #menu ul li a:hover {
    color: white;
}

/* Menu hamburger */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 28px;
    cursor: pointer;
    padding: 5px;
}

.menu-toggle:hover {
    opacity: 0.8;
}

/* --- HERO SECTION --- */
.hero {
    background: url('../images/hero-bg.jpg') center/cover no-repeat;
    height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: white;
    padding: 20px;
    margin-top: 80px; /* Pour éviter que le header cache la section */
}

.hero-content {
    max-width: 600px;
    animation: fadeIn 1s ease-in-out;
}

.hero h1 {
    font-size: 36px;
    margin-bottom: 15px;
}

.hero p {
    font-size: 18px;
    margin-bottom: 20px;
}

.btn {
    display: inline-block;
    padding: 10px 20px;
    background: #444;
    color: white;
    font-size: 18px;
    text-decoration: none;
    border-radius: 5px;
    transition: background 0.3s;
}

.btn:hover {
    background: #aaa;
    color: #111;
}

/* --- SECTION PRESENTATION --- */
.features {
    padding: 50px 20px;
    text-align: center;
    background: #222;
}

.features h2 {
    font-size: 28px;
    margin-bottom: 30px;
}

.feature-container {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 20px;
}

.feature {
    background: #333;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0px 4px 10px rgba(255, 255, 255, 0.1);
    text-align: center;
    max-width: 250px;
    display: block;
    text-decoration: none;
    transition: all 0.3s;
    cursor: pointer;
    border: 2px solid #555;
}

a.feature {
    color: white;
    position: relative;
}

a.feature:hover {
    background: #444;
    transform: translateY(-5px);
    box-shadow: 0px 6px 20px rgba(255, 255, 255, 0.4);
    border-color: #aaa;
}

.feature img {
    width: 100px;
    margin-bottom: 15px;
}

.feature-icon {
    font-size: 64px;
    margin-bottom: 15px;
    line-height: 1;
}

.feature h3 {
    font-size: 20px;
    margin-bottom: 10px;
    color: white;
}

.feature p {
    font-size: 14px;
    color: #ccc;
}

.feature-link {
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px solid #555;
    font-size: 12px;
    color: #aaa;
    font-style: italic;
    transition: color 0.3s;
}

a.feature:hover .feature-link {
    color: #fff;
}

/* --- DOCUMENTS PAGE --- */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 20px;
    margin-top: 80px; /* Espace pour le header fixe */
}

.inner {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 30px;
    flex-wrap: wrap;
}

/* --- PDF Viewer --- */
.pdf-container {
    width: 65%;
    background: #222;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

#pdf-viewer {
    width: 100%;
    height: 600px;
    display: none;
    border: 1px solid #444;
    border-radius: 8px;
    background: #1a1a1a;
}

#pdf-viewer-container {
    width: 100%;
    background: #1a1a1a;
    border-radius: 8px;
    padding: 15px;
    overflow-x: auto;
}

#pdf-canvas {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
    border: 1px solid #444;
    border-radius: 4px;
    background: white;
}

.pdf-btn {
    background: #555;
    color: white;
    border: 1px solid #777;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.pdf-btn:hover:not(:disabled) {
    background: #666;
    border-color: #999;
}

.pdf-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#pdf-viewer-fallback {
    width: 100%;
    height: 600px;
    display: none;
    border: 1px solid #444;
    border-radius: 8px;
    background: #1a1a1a;
}

.video-container {
    background: #222;
    padding: 20px;
    border-radius: 10px;
    margin-top: 20px;
    position: relative;
    width: 100%;
}

.video-container iframe {
    width: 100%;
    max-width: 100%;
    height: 500px;
    border-radius: 10px;
}

.section-title {
    text-align: center;
    margin-bottom: 40px;
    width: 100%;
    flex-basis: 100%;
}

.section-title h2 {
    font-size: 32px;
    margin-bottom: 10px;
    color: white;
}

.section-title p {
    font-size: 18px;
    color: #ccc;
}

/* --- DOCUMENT GRID (Aligné à Gauche) --- */
.document-grid {
    width: 30%;
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: flex-start; /* Alignement à gauche */
}

.document-card {
    background: #333;
    padding: 20px;
    text-align: center;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    width: 100%;
    border: 2px solid transparent;
}

.document-card:hover {
    background: #444;
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(255, 255, 255, 0.1);
}

.document-card.active {
    background: #555;
    border-color: #aaa;
    box-shadow: 0 5px 15px rgba(255, 255, 255, 0.2);
}

.document-card img {
    width: 100px;
    height: 100px;
    border-radius: 8px;
}

.document-icon {
    font-size: 48px;
    margin-bottom: 10px;
}

.document-card h3 {
    margin-top: 10px;
    font-size: 16px;
}

.document-card .btn {
    display: inline-block;
    margin-top: 8px;
    padding: 8px 12px;
    font-size: 14px;
    background: white;
    color: black;
    border-radius: 5px;
}

/* --- FOOTER --- */
footer {
    background: #222;
    color: white;
    text-align: center;
    padding: 15px 0;
    margin-top: 30px;
}

/* --- RESPONSIVE DESIGN --- */

/* Tablettes et écrans moyens (768px - 1024px) */
@media (max-width: 1024px) {
    .pdf-container {
        width: 60%;
    }

    .document-grid {
        width: 35%;
    }

    .header, #header {
        padding: 15px 20px;
    }

    #pdf-viewer {
        height: 550px;
    }

    .video-container iframe {
        height: 450px;
    }
}

/* Écrans moyens-large (1024px - 1200px) */
@media (min-width: 1025px) and (max-width: 1200px) {
    .pdf-container {
        width: 62%;
    }

    .document-grid {
        width: 33%;
    }
}

/* Tablettes et mobiles (max-width: 768px) */
@media (max-width: 768px) {
    .header, #header {
        padding: 8px 15px;
        flex-wrap: wrap;
        min-height: 50px;
    }

    .header .logo, #header h1 a {
        font-size: 16px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 60%;
    }

    .menu-toggle {
        display: block;
        font-size: 24px;
        padding: 5px;
    }

    .header nav, #menu {
        width: 100%;
        display: none;
        margin-top: 10px;
    }

    .header nav.active, #menu.active {
        display: block;
    }

    .header nav ul, #menu ul {
        flex-direction: column;
        width: 100%;
        padding: 0;
    }

    .header nav ul li, #menu ul li {
        margin: 5px 0;
        width: 100%;
    }

    .header nav ul li a, #menu ul li a {
        display: block;
        padding: 10px;
        text-align: center;
        border-radius: 5px;
        background: #333;
    }

    .header nav ul li a:hover, #menu ul li a:hover {
        background: #444;
        color: white;
    }

    .hero {
        height: 70vh;
        margin-top: 70px;
        padding: 15px;
    }

    .hero h1 {
        font-size: 24px;
        margin-bottom: 12px;
    }

    .hero p {
        font-size: 16px;
        margin-bottom: 15px;
    }

    .hero-content {
        max-width: 100%;
    }

    .btn {
        font-size: 16px;
        padding: 10px 18px;
    }

    .features {
        padding: 40px 15px;
    }

    .features h2 {
        font-size: 24px;
        margin-bottom: 25px;
    }

    .feature-container {
        flex-direction: column;
        align-items: center;
        gap: 15px;
    }

    .feature {
        max-width: 100%;
        width: 100%;
    }

    .container {
        padding: 20px 15px;
        margin-top: 50px !important;
    }

    .inner {
        flex-direction: column;
        align-items: stretch;
        gap: 20px;
    }

    .section-title h2 {
        font-size: 24px;
        margin-bottom: 8px;
    }

    .section-title p {
        font-size: 16px;
    }

    .pdf-container {
        width: 100%;
        margin-bottom: 20px;
        order: 1; /* PDF en premier sur mobile (après le titre) */
        padding: 15px;
        scroll-margin-top: 60px;
    }

    .section-title {
        order: 0; /* Titre toujours en premier */
    }

    #pdf-viewer {
        height: 500px;
        min-height: 400px;
    }
    
    #pdf-viewer-container {
        padding: 10px;
    }
    
    #pdf-canvas {
        max-width: 100%;
        width: 100%;
    }
    
    #pdf-controls {
        flex-direction: column;
        gap: 8px;
    }
    
    .pdf-btn {
        width: 100%;
        padding: 10px;
        font-size: 16px;
    }
    
    #pdf-viewer-fallback {
        height: 500px;
        min-height: 400px;
    }

    .video-container {
        margin-top: 20px;
        padding: 15px;
    }

    .video-container iframe {
        height: 250px !important;
    }

    .document-grid {
        width: 100%;
        align-items: stretch;
        order: 2; /* Documents après le PDF sur mobile */
        gap: 12px;
        margin-bottom: 10px;
    }

    .document-card {
        width: 100%;
        padding: 15px;
        margin-bottom: 0;
    }

    .section-title {
        margin-bottom: 20px;
    }

    .document-icon {
        font-size: 40px;
    }

    .document-card h3 {
        font-size: 15px;
    }

    /* Amélioration visuelle des cartes sur mobile */
    .document-card.active {
        border-width: 3px;
        box-shadow: 0 3px 10px rgba(170, 170, 170, 0.3);
    }
}

/* Petits mobiles (max-width: 480px) */
@media (max-width: 480px) {
    .header, #header {
        padding: 6px 12px;
        min-height: 45px;
    }

    .header .logo, #header h1 a {
        font-size: 14px;
        max-width: 55%;
    }

    .menu-toggle {
        font-size: 22px;
        padding: 3px;
    }

    .hero {
        height: 60vh;
        margin-top: 45px;
        padding: 10px;
    }

    .hero h1 {
        font-size: 20px;
        margin-bottom: 10px;
    }

    .hero p {
        font-size: 14px;
        margin-bottom: 12px;
    }

    .btn {
        font-size: 14px;
        padding: 8px 16px;
    }

    .features {
        padding: 30px 10px;
    }

    .features h2 {
        font-size: 20px;
        margin-bottom: 20px;
    }

    .feature {
        padding: 15px;
    }

    .feature-icon {
        font-size: 48px;
        margin-bottom: 12px;
    }

    .feature h3 {
        font-size: 18px;
        margin-bottom: 8px;
    }

    .feature p {
        font-size: 13px;
    }

    .container {
        padding: 15px 10px;
        margin-top: 45px !important;
    }

    .section-title h2 {
        font-size: 20px;
    }

    .section-title p {
        font-size: 14px;
    }

    .pdf-container {
        padding: 10px;
    }

    #pdf-viewer {
        height: 450px;
        min-height: 350px;
    }

    .video-container {
        padding: 10px;
    }

    .video-container h3 {
        font-size: 16px;
        margin-bottom: 10px;
    }

    .video-container iframe {
        height: 200px !important;
    }

    .document-card {
        padding: 12px;
    }

    .document-icon {
        font-size: 36px;
        margin-bottom: 8px;
    }

    .document-card h3 {
        font-size: 14px;
        margin-top: 8px;
    }

    .document-card .btn {
        font-size: 12px;
        padding: 6px 10px;
        margin-top: 6px;
    }

    /* Amélioration visuelle des cartes sur petits écrans */
    .document-card.active {
        border-width: 2px;
        box-shadow: 0 2px 8px rgba(170, 170, 170, 0.25);
    }

    footer {
        padding: 12px 0;
        font-size: 14px;
    }
}

/* --- QUIZ STYLES --- */
.quiz-screen {
    max-width: 800px;
    margin: 0 auto;
}

.quiz-card {
    background: #222;
    padding: 40px;
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5);
}

.quiz-icon {
    font-size: 80px;
    text-align: center;
    margin-bottom: 20px;
}

.quiz-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 2px solid #444;
}

.progress-text {
    color: #aaa;
    font-size: 16px;
}

.score-text {
    color: #fff;
    font-weight: bold;
    font-size: 18px;
}

.question-text {
    font-size: 24px;
    font-weight: bold;
    color: white;
    margin-bottom: 30px;
    line-height: 1.4;
    text-align: center;
}

/* Bloc de question mis en valeur (ludique et lisible) */
.question-block {
    background: linear-gradient(135deg, #2a2a2a 0%, #1f1f1f 100%);
    border-radius: 16px;
    padding: 24px 28px;
    margin-bottom: 28px;
    border-left: 5px solid #2a5a8c;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    position: relative;
}

.question-block::before {
    content: "❓";
    position: absolute;
    top: 20px;
    left: 24px;
    font-size: 28px;
    opacity: 0.6;
}

.question-text {
    padding-left: 44px;
    text-align: left;
}

.question-prompt {
    display: block;
    color: #e8e8e8;
    font-size: 1.15rem;
    font-weight: 600;
    line-height: 1.5;
    margin-bottom: 16px;
}

.question-term {
    display: block;
    background: rgba(42, 90, 140, 0.25);
    color: #a8d0e6;
    font-family: inherit;
    font-size: 1.05rem;
    font-weight: 500;
    line-height: 1.6;
    padding: 16px 20px;
    border-radius: 12px;
    border: 1px solid rgba(42, 90, 140, 0.5);
    white-space: pre-line;
    word-break: break-word;
}

/* Quand la question n'a pas de partie "term" (pas de \n\n) */
.question-block .question-text:not(:has(.question-prompt)) {
    padding-left: 0;
    text-align: center;
}

.options-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
}

.option-btn {
    padding: 18px 24px;
    background: #333;
    color: white;
    border: 2px solid #444;
    border-radius: 8px;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s;
    text-align: left;
    width: 100%;
}

.option-btn:hover:not(:disabled) {
    background: #444;
    border-color: #666;
    transform: translateX(5px);
}

.option-btn:disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

.option-btn.correct {
    background: #2d5016;
    border-color: #4a7c2a;
    color: #a8e063;
}

.option-btn.incorrect {
    background: #5a1a1a;
    border-color: #7c2a2a;
    color: #ff6b6b;
}

.feedback {
    padding: 15px;
    border-radius: 8px;
    margin-top: 20px;
    font-size: 16px;
    line-height: 1.5;
    min-height: 50px;
}

.correct-feedback {
    background: #2d5016;
    color: #a8e063;
    border: 2px solid #4a7c2a;
}

.incorrect-feedback {
    background: #5a1a1a;
    color: #ff6b6b;
    border: 2px solid #7c2a2a;
}

.quiz-btn {
    padding: 15px 40px;
    background: #444;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    width: 100%;
    max-width: 300px;
    margin: 0 auto;
    display: block;
}

.quiz-btn:hover {
    background: #555;
    transform: scale(1.05);
}

.quiz-btn.primary {
    background: #4a7c2a;
}

.quiz-btn.primary:hover {
    background: #5a9c3a;
}

/* Question Count Selector */
.question-count-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.question-count-btn {
    padding: 12px 24px;
    background: #333;
    color: white;
    border: 2px solid #444;
    border-radius: 8px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    min-width: 60px;
}

.question-count-btn:hover {
    background: #444;
    border-color: #666;
    transform: translateY(-2px);
}

.question-count-btn.selected {
    background: #4a7c2a;
    border-color: #5a9c3a;
    color: #fff;
}

.question-count-btn.selected:hover {
    background: #5a9c3a;
}

/* Quiz Selection Grid */
.quiz-selection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin: 30px 0;
}

.quiz-type-btn {
    padding: 25px 20px;
    background: #333;
    color: white;
    border: 2px solid #444;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.quiz-type-btn:hover {
    background: #444;
    border-color: #4a7c2a;
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(74, 124, 42, 0.3);
}

.quiz-type-icon {
    font-size: 48px;
    margin-bottom: 5px;
}

.quiz-type-btn h4 {
    margin: 0;
    font-size: 20px;
    color: white;
}

.quiz-type-btn p {
    margin: 0;
    font-size: 14px;
    color: #aaa;
}

@media (max-width: 768px) {
    .quiz-selection-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 15px;
    }
    
    .quiz-type-btn {
        padding: 20px 15px;
    }
    
    .quiz-type-icon {
        font-size: 40px;
    }
    
    .quiz-type-btn h4 {
        font-size: 18px;
    }
    
    .quiz-type-btn p {
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .quiz-selection-grid {
        grid-template-columns: 1fr !important;
    }
    
    .quiz-type-btn {
        padding: 18px 15px;
    }
    
    .quiz-type-icon {
        font-size: 36px;
    }
}

/* Results Screen */
.results-header {
    text-align: center;
    margin-bottom: 30px;
}

.results-icon {
    font-size: 80px;
    margin-bottom: 20px;
}

.results-score-container {
    margin: 20px 0;
}

.results-score {
    font-size: 48px;
    font-weight: bold;
    color: white;
    margin-bottom: 10px;
}

.results-percentage {
    font-size: 32px;
    color: #aaa;
    margin-bottom: 20px;
}

.results-message {
    font-size: 20px;
    color: #fff;
    padding: 15px;
    background: #333;
    border-radius: 8px;
    margin-top: 20px;
}

.results-details {
    margin-top: 30px;
    text-align: left;
}

.result-detail {
    background: #333;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 15px;
    border-left: 4px solid #444;
}

.result-question {
    font-size: 18px;
    font-weight: bold;
    color: white;
    margin-bottom: 10px;
}

.result-answer {
    font-size: 16px;
    line-height: 1.6;
}

.result-answer.correct {
    color: #a8e063;
}

.result-answer.incorrect {
    color: #ff6b6b;
}

/* Responsive Quiz */
@media (max-width: 768px) {
    .quiz-screen {
        padding: 0 10px;
    }

    .quiz-card {
        padding: 25px 20px;
    }

    .quiz-icon {
        font-size: 60px;
    }

    .question-text {
        font-size: 18px;
        margin-bottom: 20px;
    }

    .question-block {
        padding: 18px 20px;
        margin-bottom: 22px;
        border-radius: 12px;
    }

    .question-block::before {
        font-size: 22px;
        top: 16px;
        left: 18px;
    }

    .question-text {
        padding-left: 38px;
    }

    .question-prompt {
        font-size: 1rem;
        margin-bottom: 12px;
    }

    .question-term {
        font-size: 0.95rem;
        padding: 12px 14px;
    }

    .option-btn {
        font-size: 15px;
        padding: 14px 18px;
    }

    .quiz-header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
        margin-bottom: 20px;
    }

    .progress-text {
        font-size: 14px;
    }

    .score-text {
        font-size: 16px;
    }

    .feedback {
        font-size: 14px;
        padding: 12px;
    }

    .quiz-btn {
        font-size: 16px;
        padding: 12px 30px;
    }

    .results-icon {
        font-size: 60px;
    }

    .results-score {
        font-size: 36px;
    }

    .results-percentage {
        font-size: 24px;
    }

    .results-message {
        font-size: 18px;
        padding: 12px;
    }

    .result-detail {
        padding: 15px;
    }

    .result-question {
        font-size: 16px;
    }

    .result-answer {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .quiz-card {
        padding: 20px 15px;
    }

    .quiz-icon {
        font-size: 50px;
        margin-bottom: 15px;
    }

    .question-text {
        font-size: 16px;
        margin-bottom: 18px;
    }

    .question-block {
        padding: 14px 16px;
        margin-bottom: 18px;
    }

    .question-block::before {
        font-size: 20px;
        top: 14px;
        left: 14px;
    }

    .question-text {
        padding-left: 34px;
    }

    .question-prompt {
        font-size: 0.95rem;
        margin-bottom: 10px;
    }

    .question-term {
        font-size: 0.9rem;
        padding: 10px 12px;
    }

    .option-btn {
        font-size: 14px;
        padding: 12px 15px;
    }

    .quiz-header {
        margin-bottom: 15px;
        padding-bottom: 12px;
    }

    .progress-text {
        font-size: 13px;
    }

    .score-text {
        font-size: 15px;
    }

    .feedback {
        font-size: 13px;
        padding: 10px;
        min-height: 45px;
    }

    .quiz-btn {
        font-size: 15px;
        padding: 10px 25px;
    }

    .results-icon {
        font-size: 50px;
        margin-bottom: 15px;
    }

    .results-score {
        font-size: 32px;
    }

    .results-percentage {
        font-size: 20px;
    }

    .results-message {
        font-size: 16px;
        padding: 10px;
    }

    .result-detail {
        padding: 12px;
        margin-bottom: 12px;
    }

    .result-question {
        font-size: 15px;
        margin-bottom: 8px;
    }

    .result-answer {
        font-size: 13px;
    }
}

/* --- PAGE COMPÉTITION POOMSAE (compet.html) --- */
body.compet-page {
    overflow-x: hidden;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.compet-main {
    width: 100%;
    max-width: none;
    padding: 100px 0 0;
    margin: 0;
    box-sizing: border-box;
}

/* Mobile + téléphone paysage (largeur > 768px) : padding du contenu selon barre visible / masquée */
@media (max-width: 768px), (orientation: landscape) and (max-height: 560px) {
    body.compet-page:has(.header:not(.header-hidden)) .compet-main {
        padding-top: calc(52px + env(safe-area-inset-top, 0px));
        transition: padding-top 0.3s ease;
    }

    body.compet-page:has(.header.header-hidden) .compet-main {
        padding-top: max(2px, env(safe-area-inset-top));
        transition: padding-top 0.3s ease;
    }
}

/* Paysage : barre plus basse si visible ; moins de marge autour du titre et de l’historique */
@media (orientation: landscape) and (max-height: 560px) {
    body.compet-page .header:not(.header-hidden) {
        padding: 6px 12px;
        min-height: 0;
    }

    body.compet-page .header:not(.header-hidden) .logo {
        font-size: 14px;
        max-width: calc(100vw - 80px);
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    body.compet-page .compet-hero {
        margin-bottom: 0.35rem;
    }

    body.compet-page .compet-hero h1 {
        font-size: 1.1rem;
    }

    body.compet-page .compet-history-section {
        padding: 0.65rem 0.75rem 1rem;
        min-height: 0;
    }

    body.compet-page .compet-history-header {
        margin-bottom: 0.5rem;
    }

    body.compet-page .compet-history-header h2 {
        font-size: 1rem;
    }

    body.compet-page #compet-step-1 {
        min-height: 0;
        padding: 0.65rem 0.75rem 0.75rem;
    }

    body.compet-page .compet-tech-landscape {
        min-height: 7rem;
        padding-top: 0.25rem;
        padding-bottom: 0.25rem;
    }

    body.compet-page .compet-tech-big {
        font-size: 2.75rem;
    }

    body.compet-page .compet-deduct-btn {
        width: 4.75rem;
        height: 4.75rem;
        font-size: 0.9rem;
    }

    body.compet-page .compet-next-step1 {
        margin-top: 0.5rem;
    }

    body.compet-page footer {
        padding: 6px 8px;
        font-size: 11px;
        margin-top: 0;
    }

    body.compet-page footer p {
        margin: 0;
    }
}

.compet-panel {
    max-width: 720px;
    margin: 0 auto;
    padding: 0 0.75rem 1rem;
    width: 100%;
    box-sizing: border-box;
}

.compet-hero {
    text-align: center;
    margin-bottom: 0.75rem;
    width: 100%;
}

.compet-hero h1 {
    font-size: 1.35rem;
    margin: 0;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.compet-wizard {
    background: #1a1a1a;
    border-radius: 10px;
    padding: 0;
    margin: 0 auto 1rem;
    border: 1px solid #333;
    overflow: hidden;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.compet-step-padded {
    padding: 1.25rem 1rem 1.5rem;
}

.compet-step[hidden] {
    display: none !important;
}

.compet-step-title {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    color: #fff;
}

.compet-step-desc {
    color: #aaa;
    font-size: 0.95rem;
    margin-bottom: 1.25rem;
}

.compet-step-title--compact {
    margin-bottom: 1rem;
    font-size: 1.05rem;
}

/* Étape 1 : grille 3 colonnes — gauche | centre | droite, alignée et centrée */
#compet-step-1 {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    min-height: 17rem;
    padding: 1.5rem 1rem 1.25rem;
    box-sizing: border-box;
}

.compet-tech-landscape {
    display: grid;
    grid-template-columns: minmax(5.25rem, auto) minmax(0, 1fr) minmax(5.25rem, auto);
    align-items: center;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding: 0.5rem max(8px, env(safe-area-inset-left)) 0.5rem max(8px, env(safe-area-inset-right));
    box-sizing: border-box;
    column-gap: 0.5rem;
    min-height: 10rem;
}

.compet-tech-landscape > .compet-deduct-btn:first-of-type {
    justify-self: start;
}

.compet-tech-landscape > .compet-deduct-btn:last-of-type {
    justify-self: end;
}

.compet-deduct-btn {
    width: 5.5rem;
    height: 5.5rem;
    padding: 0;
    border-radius: 50%;
    border: 2px solid #555;
    background: #2a2a2a;
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, border-color 0.15s, transform 0.1s;
    flex-shrink: 0;
}

.compet-deduct-btn:hover {
    background: #383838;
    border-color: #777;
}

.compet-deduct-btn:active {
    transform: scale(0.96);
}

.compet-deduct-btn:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 3px;
}

.compet-tech-block {
    grid-column: 2;
    justify-self: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-width: 0;
    width: max-content;
    max-width: min(100%, 11rem);
}

.compet-next-step1 {
    display: block;
    margin: 1.25rem auto 0;
    width: fit-content;
    max-width: 100%;
}

.compet-tech-big {
    font-size: 3.75rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    letter-spacing: 0.02em;
}

.compet-tech-suffix {
    font-size: 1.05rem;
    color: #888;
    margin-top: 0.2rem;
    line-height: 1.2;
}

.compet-preview {
    margin: 1rem 0;
    font-size: 1rem;
    color: #ccc;
}

.compet-preview--inline {
    text-align: center;
    margin-top: 0.5rem;
    font-size: 1.1rem;
}

.btn-compact {
    padding: 8px 12px;
    font-size: 14px;
}

.compet-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.compet-modal[hidden] {
    display: none !important;
}

.compet-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
}

.compet-modal-box {
    position: relative;
    width: 100%;
    max-width: 400px;
    padding: 1.25rem 1.5rem;
    background: #1e1e1e;
    border: 1px solid #444;
    border-radius: 10px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

.compet-modal-title {
    font-size: 1.15rem;
    margin: 0 0 1rem;
    color: #fff;
}

.compet-modal-label {
    display: block;
    font-size: 0.9rem;
    color: #bbb;
    margin-bottom: 0.35rem;
}

.compet-modal-input {
    width: 100%;
    box-sizing: border-box;
    padding: 0.65rem 0.75rem;
    margin-bottom: 1.25rem;
    font-size: 1rem;
    border: 1px solid #555;
    border-radius: 6px;
    background: #111;
    color: #fff;
}

.compet-modal-input:focus {
    outline: none;
    border-color: #888;
}

.compet-modal-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.compet-history-label {
    display: block;
    font-size: 1.05rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 0.35rem;
    word-break: break-word;
}

.compet-criteria {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.compet-criterion-label {
    font-weight: 700;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    color: #ddd;
}

.compet-value-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    justify-content: center;
    margin-bottom: 0.25rem;
}

.compet-value-btn {
    min-width: 2.4rem;
    min-height: 2.1rem;
    padding: 0.45rem 0.35rem;
    font-size: 0.74rem;
    font-variant-numeric: tabular-nums;
    border: 1px solid #444;
    border-radius: 6px;
    background: #252525;
    color: #ccc;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.compet-value-btn:hover {
    background: #333;
    border-color: #666;
    color: #fff;
}

.compet-value-btn--selected {
    background: #3a3a3a;
    border-color: #888;
    color: #fff;
    font-weight: 700;
}

.compet-value-btn:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 1px;
}

.compet-step-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.25rem;
    flex-wrap: wrap;
    align-items: center;
}

.compet-step-actions--wrap {
    justify-content: flex-start;
}

.compet-final-display {
    text-align: center;
    padding: 1.5rem;
    background: #222;
    border-radius: 10px;
    margin-top: 0.5rem;
    margin-bottom: 1.25rem;
}

.compet-final-label {
    display: block;
    font-size: 0.95rem;
    color: #aaa;
    margin-bottom: 0.25rem;
}

.compet-final-number {
    font-size: 3rem;
    font-weight: bold;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
}

.compet-final-max {
    display: block;
    font-size: 1rem;
    color: #888;
    margin-top: 0.25rem;
}

.compet-adjust {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.compet-adjust-row {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    min-width: 4.5rem;
}

.compet-adjust-label {
    font-size: 0.85rem;
    color: #aaa;
    margin-bottom: 0.15rem;
}

.compet-arrow {
    width: 2.5rem;
    height: 2rem;
    font-size: 0.85rem;
    line-height: 1;
    border: 1px solid #555;
    background: #333;
    color: #fff;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
}

.compet-arrow:hover {
    background: #444;
}

.compet-arrow:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.btn-secondary {
    background: #333;
    color: #fff;
    border: 1px solid #555;
}

.btn-secondary:hover {
    background: #444;
}

.btn-danger {
    background: #5a2a2a;
    color: #fff;
    border: 1px solid #7a3a3a;
}

.btn-danger:hover {
    background: #6a3333;
}

.compet-history-section {
    margin-top: 0;
    padding: 1.75rem 1rem 2.5rem;
    background: #0a0a0a;
    border-top: 4px solid #2a2a2a;
    max-width: none;
    width: 100%;
    box-sizing: border-box;
    min-height: 140px;
}

.compet-history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1rem;
    max-width: 720px;
    margin-left: auto;
    margin-right: auto;
}

.compet-history-header h2 {
    font-size: 1.2rem;
    margin: 0;
}

.compet-history-list {
    list-style: none;
    padding: 0;
    margin: 0 auto;
    max-width: 720px;
}

.compet-history-empty {
    color: #888;
    font-style: italic;
    padding: 0.5rem 0;
}

.compet-history-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    background: #1a1a1a;
    border: 1px solid #333;
    margin-bottom: 0.5rem;
}

.compet-history-date {
    font-size: 0.85rem;
    color: #888;
}

.compet-history-score {
    font-size: 1.25rem;
    font-weight: bold;
    font-variant-numeric: tabular-nums;
}

.compet-history-detail {
    font-size: 0.85rem;
    color: #aaa;
    line-height: 1.4;
}

@media (max-width: 480px) {
    .compet-main {
        padding-top: 90px;
    }

    .compet-panel {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }

    .compet-tech-big {
        font-size: 3rem;
    }

    .compet-deduct-btn {
        width: 5rem;
        height: 5rem;
        font-size: 0.95rem;
    }

    .compet-final-number {
        font-size: 2.25rem;
    }

    .compet-adjust {
        flex-direction: column;
        align-items: stretch;
    }

    .compet-adjust-row {
        flex-direction: row;
        justify-content: center;
    }
}

/* --- ANIMATIONS --- */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
