/* =====================================================
   NOUVEAU DESIGN SYSTEM (CHARTE GRAPHIQUE)
   ===================================================== */
@import url('https://fonts.googleapis.com/css2?family=Gotu&family=Urbanist:wght@400;500;600;700&display=swap');

:root {
    /* Polices */
    --font-titre: 'Gotu', serif;
    --font-body: 'Urbanist', sans-serif;
    
    /* Couleurs (Charte) */
    --color-accent: #fd5c02;  /* Couleur1 */
    --color-base: #1a1a1a;    /* Couleur2 */
    --color-notes: #57595b;   /* Couleur3 */
    
    /* Couleurs (Neutres) */
    --color-white: #ffffff;
    --color-bg: #f0f2f5;
    --color-border: #ddd;
    --color-shadow: rgba(0, 0, 0, 0.1);
    
    /* Couleurs (Feedback) */
    --color-success-bg: #d1fae5;
    --color-success-border: #10b981;
    --color-success-text: #065f46;
    --color-error-bg: #fee2e2;
    --color-error-border: #ef4444;
    --color-error-text: #991b1b;
}

/* ... (Styles globaux inchangés) ... */
html, body {
    width: 100vw;
    height: 100vh;
    margin: 0;
    padding: 0;
    overflow: hidden; 
    position: fixed; 
    overscroll-behavior-y: contain; 
}

body {
    font-family: var(--font-body);
    background-color: var(--color-bg);
    color: var(--color-base);
    display: flex;
    justify-content: center;
    align-items: center;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-titre);
    font-weight: 600;
    color: var(--color-base);
}

.logo {
    display: block;
    max-height: 45px;
    width: auto;
    margin: 0 auto 30px auto;
}

/* ... (Classes .content-box, .register-container, .game-container inchangées) ... */
.content-box {
    background-color: var(--color-white);
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 4px 20px var(--color-shadow);
    width: 100%;
    box-sizing: border-box;
    text-align: center;
}

.register-container {
    max-width: 500px;
    margin: 2rem auto;
}

.game-container {
    max-width: 900px;
    margin: 2rem auto;
    max-height: calc(100vh - 4rem);
    overflow-y: auto;
}

/* ... (Classe .page-register inchangée) ... */
.page-register {
    overflow-y: auto !important;
    position: static !important;
    height: auto; 
    min-height: 100vh;
}

/* ... (Classes .form-group et inputs inchangées) ... */
.form-group {
    margin-bottom: 20px;
    text-align: left;
}
.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
}
.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="tel"] {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    box-sizing: border-box;
    font-size: 1rem;
    font-family: var(--font-body);
}

/* ... (Classes button, .error-message, .rules inchangées) ... */
button, .submit-button {
    background-color: var(--color-accent);
    color: var(--color-white);
    padding: 14px 24px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 600;
    transition: background-color 0.3s ease;
    width: 100%;
    box-sizing: border-box;
    font-family: var(--font-body);
}
button:hover:not(:disabled) {
    background-color: var(--color-notes);
}
button:disabled {
    background-color: #93c5fd;
    cursor: not-allowed;
}

.error-message {
    color: var(--color-error-border);
    margin-top: 10px;
    font-weight: 500;
}
.rules {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #eee;
    text-align: left;
}
.rules h3 {
    text-align: center;
    margin-bottom: 15px;
    color: var(--color-accent);
}
.rules ol {
    padding-left: 20px;
}
.rules li {
    margin-bottom: 8px;
}

/* ... (Classes .orientation-lock et animation inchangées) ... */
.orientation-lock {
    display: none; 
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: var(--color-bg);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    text-align: center;
    flex-direction: column;
    padding: 20px;
    box-sizing: border-box;
}
.orientation-content {
    background-color: var(--color-white);
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 15px var(--color-shadow);
    max-width: 400px;
}
.orientation-content h2 {
    color: var(--color-accent);
    margin-bottom: 10px;
}
.orientation-content p {
    color: var(--color-notes);
    font-size: 1.1rem;
}
.rotate-animation-container {
    width: 150px;
    height: 120px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto 20px auto;
}
.phone-icon {
    width: 70px;
    height: 120px;
    border: 5px solid #888;
    border-radius: 12px;
    background: #fff;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    animation: rotate-phone 3s ease-in-out infinite;
}
.phone-icon::before {
    content: '';
    position: absolute;
    top: 8px;
    width: 20px;
    height: 3px;
    background: #ccc;
    border-radius: 2px;
}
.phone-screen {
    width: 56px;
    height: 90px;
    background: #f0f2f5;
    color: #555;
    font-weight: bold;
    font-size: 0.9rem;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    border-radius: 4px;
    line-height: 1.2;
}
@keyframes rotate-phone {
    0% { transform: rotate(0deg); }
    20% { transform: rotate(0deg); }
    40% { transform: rotate(-90deg); }
    60% { transform: rotate(-90deg); }
    80% { transform: rotate(0deg); }
    100% { transform: rotate(0deg); }
}

/* ... (Classes .game-world, .game-grid, .letter-box, .hint-btn, etc. inchangées) ... */
.game-world {
    display: none; 
    width: 100vw;
    height: 100vh;
    padding: 20px;
    box-sizing: border-box;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}
.game-container h2 {
    text-align: center;
}
.game-grid {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    margin-top: 30px;
    margin-bottom: 30px;
}
.line-break {
    flex-basis: 100%;
    height: 0;
    margin: 0;
    padding: 0;
}
.letter-group {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 70px;
}
.letter-box {
    width: 50px;
    height: 50px;
    text-align: center;
    font-size: 2rem;
    font-weight: bold;
    border: 2px solid var(--color-border);
    border-radius: 8px;
    background-color: var(--color-white);
    transition: border-color 0.3s ease, background-color 0.3s ease;
    text-transform: uppercase;
}
.letter-box:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(253, 92, 2, 0.2);
}
.letter-box.correct {
    background-color: var(--color-success-bg);
    border-color: var(--color-success-border);
    color: var(--color-success-text);
}
.letter-box.incorrect {
    background-color: var(--color-error-bg);
    border-color: var(--color-error-border);
    color: var(--color-error-text);
}
.hint-tooltip {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--color-base);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 50;
}
.letter-group:hover .hint-tooltip,
.letter-group .letter-box:focus + .hint-tooltip {
    opacity: 1;
}
.hint-btn {
    background-color: var(--color-accent);
    color: var(--color-white);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.2rem;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
    border: none;
    box-shadow: 0 2px 5px var(--color-shadow);
    transition: background-color 0.3s ease;
}
.hint-btn:hover {
    background-color: var(--color-notes);
}
.submit-button {
    margin-top: 30px;
    max-width: 300px;
    margin-left: auto;
    margin-right: auto;
}
#game-message {
    margin-top: 20px;
    font-size: 1.1rem;
    font-weight: 600;
}
.message-success {
    color: var(--color-success-border);
}
.message-error {
    color: var(--color-error-border);
}

/* =====================================================
   MODALES (Popups) - CORRECTION ESPACEMENT
   ===================================================== */
.modal {
    /* ... (inchangé) ... */
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    overflow-y: auto; 
    background-color: rgba(0, 0, 0, 0.85);
    animation: fadeIn 0.3s;
    justify-content: center;
    align-items: center;
    padding: 0; 
    box-sizing: border-box;
    overscroll-behavior-y: contain;
}
.modal-content {
    /* ... (inchangé, padding-bottom: 80px est déjà là) ... */
    background-color: var(--color-white);
    padding: 30px;
    border-radius: 0; 
    width: 100%;
    max-width: 100%;
    min-height: 100vh; 
    max-height: 100vh;
    box-shadow: none;
    box-sizing: border-box;
    display: flex;
    text-align: left;
    overflow-y: auto; 
    flex-direction: row;
    align-items: flex-start;
    padding-bottom: 80px;
}
.modal-image {
    /* ... (inchangé) ... */
    flex-basis: 33.33%;
    flex-shrink: 0;
    margin-right: -30px;
}
.modal-image img {
    width: 70%;
    height: auto;
    border-radius: 8px;
    /* background-color: #eee; */
    aspect-ratio: 10 / 16;
    object-fit: cover;
}
.modal-text-content {
    /* ... (inchangé) ... */
    flex-basis: 66.67%;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-height: 200px;
}
.modal-content h2.bio-name {
    /* ... (inchangé) ... */
    color: var(--color-accent);
    margin-top: 0;
    margin-bottom: 0px;
    font-size: 2.0rem;
    text-align: left;
}
.modal-content h3.bio-title {
    /* ... (inchangé) ... */
    color: var(--color-notes);
    margin: 0 0 15px 0;
    font-size: 1.3rem;
    font-weight: normal;
    text-align: left;
}

/* === CORRECTION MARGE PARAGRAPHE === */
.modal-content p.bio-text {
    font-size: 1rem;
    line-height: 1.7;
    text-align: left;
    margin-top: 5px; /* Ajoute de l'espace AVANT chaque paragraphe */
    margin-bottom: 0px; /* Supprime l'espace APRÈS (comme demandé) */
}
/* Annule la marge en haut pour le tout premier paragraphe */
.modal-content p.bio-text:first-of-type {
    margin-top: 0;
}
/* ===================================== */

.modal-return-btn {
    /* ... (inchangé) ... */
    background-color: var(--color-accent);
    color: var(--color-white);
    padding: 12px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s ease;
    margin-top: 15px;
    width: auto;
    align-self: flex-end;
    float: none;
}
.modal-return-btn:hover {
    background-color: var(--color-notes);
}

/* ... (Reste du CSS : @keyframes, @media queries, gestion orientation) ... */
@keyframes fadeIn {
    from {opacity: 0;}
    to {opacity: 1;}
}

@media (max-width: 768px) {
    .content-box, .game-container {
        padding: 20px;
        margin-bottom: 4rem; 
    }
    .register-container {
        width: 90%;
    }
    
    .game-grid {
        gap: 10px;
    }
    .letter-group {
        width: 60px;
    }
    .letter-box {
        width: 45px;
        height: 45px;
    }
    .hint-btn {
        width: 35px;
        height: 35px;
    }

    .modal-content {
        flex-direction: column;
        align-items: center;
        overflow-y: auto; 
        min-height: 100vh;
        padding: 30px 20px; 
        padding-bottom: 80px;
    }
    .modal-image {
        flex-basis: auto;
        margin-right: 0;
        margin-bottom: 20px;
        width: 150px;
    }
    .modal-text-content {
        flex-basis: auto;
        align-items: center;
        min-height: auto;
    }
    .modal-text-content h2.bio-name,
    .modal-text-content h3.bio-title,
    .modal-text-content p.bio-text {
        text-align: center;
    }
    .modal-return-btn {
        align-self: center;
        margin-top: 30px; 
    }
}

@media (orientation: landscape) {
    body.page-game .game-world {
        display: flex;
    }
    body.page-game .orientation-lock {
        display: none;
    }
}

@media (orientation: portrait) {
    body.page-game .game-world {
        display: none;
    }
    body.page-game .orientation-lock {
        display: flex;
    }
}

.page-register .orientation-lock,
.page-register .game-world {
    display: none;
}