:root {
    /* PALETTE DE COULEURS LA ROCHELLE */
    --blue-rochelle: #1c9cd9;   /* Bleu principal */
    --yellow-rochelle: #FFC425;  /* Jaune accentué */
    --grey-light: #f8f9fa;
    --grey-text: #333333;
    --grey-medium: #6c757d;
}

/* --- Règle globale pour corriger les décalages --- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

@keyframes breathe { 0% { transform: scale(1); } 50% { transform: scale(1.02); } 100% { transform: scale(1); } }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes suggestion-glow {
    0% { box-shadow: 0 0 5px rgba(255, 196, 37, 0); }
    50% { box-shadow: 0 0 15px 5px rgba(255, 196, 37, 0.8); }
    100% { box-shadow: 0 0 5px rgba(255, 196, 37, 0); }
}

/* --- Structure du body améliorée --- */
html, body {
    height: 100%;
}

body { 
    font-family: 'Montserrat', sans-serif; 
    margin: 0;
    color: var(--grey-text);
    background-color: var(--grey-light);
    display: flex;
    flex-direction: column;
}

#main-container {
    flex-grow: 1;
}

.site-header { background-color: white; padding: 15px 30px; display: flex; align-items: center; border-bottom: 3px solid var(--yellow-rochelle); flex-shrink: 0; }
.site-header img { height: 50px; margin-right: 20px; }
.site-header h1 { color: #0d2c4a; font-size: 24px; margin: 0; font-weight: 700; }
#main-container { max-width: 750px; width: 90%; margin: 40px auto; text-align: center; background-color: rgba(255, 255, 255, 0.98); padding: 30px 40px; border-radius: 12px; box-shadow: 0 8px 30px rgba(0,0,0,0.1); }

#character-selector { display: flex; justify-content: center; align-items: flex-start; gap: 20px; margin-bottom: 30px; border-bottom: 1px solid #ddd; padding-bottom: 20px; }
.story-intro { text-align: center; margin: -15px 0 25px 0; padding: 0 20px; font-size: 15px; color: var(--grey-medium); line-height: 1.6; }
.character-choice { cursor: pointer; border: 3px solid transparent; border-radius: 8px; padding: 10px; transition: all 0.3s ease; opacity: 0.6; width: 120px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.character-choice:hover { opacity: 1; background-color: #f0f0f0; }
.character-choice.active { opacity: 1; border-color: var(--yellow-rochelle); transform: scale(1.05); }
.character-choice.suggested { animation: suggestion-glow 2s infinite ease-in-out; }
.character-choice img { width: 80px; height: 80px; border-radius: 50%; object-fit: cover; margin-bottom: 8px; }
.character-choice span { font-weight: 700; color: var(--blue-rochelle); text-align: center; }

#panels-wrapper { position: relative; }

.character-panel {
    opacity: 0;
    visibility: hidden;
    height: 0;
    overflow: hidden;
    transition: opacity 0.3s ease-in-out;
}
.character-panel.active {
    opacity: 1;
    visibility: visible;
    height: auto;
    overflow: visible;
}

.character-panel h2 { font-size: 28px; color: var(--grey-text); font-weight: 700; margin-bottom: 20px; margin-top: 0; }
.video-container { position: relative; width: 100%; max-width: 360px; aspect-ratio: 9/16; background: #e9ecef; border: 1px solid #dee2e6; box-shadow: 0 4px 12px rgba(0,0,0,0.08); border-radius: 12px; margin: 20px auto; overflow: hidden; }
.video-container img { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; transition: opacity 0.4s ease-in-out; }
.video-container video { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: contain; background-color: black; transition: opacity 0.4s ease-in-out; }
.video-container .default-image { animation: breathe 6s ease-in-out infinite; z-index: 1; }
.video-container video { z-index: 2; }

.loader-container { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); opacity: 0; visibility: hidden; transition: opacity 0.3s, visibility 0.3s; z-index: 10; display: flex; flex-direction: column; align-items: center; gap: 15px; }
.loader-logo { height: 60px; width: 60px; background-image: url('logo_la_rochelle.png'); background-size: contain; background-repeat: no-repeat; background-position: center; animation: spin 2s linear infinite; }
.video-container.is-loading .loader-container { opacity: 1; visibility: visible; }
.video-container.is-loading .default-image { opacity: 0.4; animation-play-state: paused; }
.video-container.video-is-active .default-image { opacity: 0; }

.text-input-container { display: flex; gap: 10px; margin-bottom: 20px; align-items: center; }
.question-input { flex-grow: 1; border: 2px solid #ced4da; border-radius: 50px; padding: 12px 20px; font-size: 16px; font-family: 'Montserrat', sans-serif; }
.question-input:focus { outline: none; border-color: var(--blue-rochelle); }
.submit-question-btn { flex-shrink: 0; background-color: var(--blue-rochelle); color: white; border: none; border-radius: 50%; width: 50px; height: 50px; cursor: pointer; font-size: 20px; transition: background-color 0.3s; }
.submit-question-btn:hover { background-color: var(--yellow-rochelle); color: #0d2c4a; }
.separator { font-weight: 700; color: var(--grey-medium); margin-bottom: 20px; }
.questions-container { margin-top: 20px; }
.questions-panel { display: flex; flex-wrap: wrap; justify-content: center; gap: 15px; }

.question-btn {
    padding: 12px 25px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    background: var(--blue-rochelle);
    color: white;
    border: 2px solid var(--blue-rochelle);
    border-radius: 50px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    white-space: normal;
    height: auto;
    min-height: 50px;
}

.question-btn:hover { background: white; color: var(--blue-rochelle); transform: translateY(-2px); box-shadow: 0 4px 10px rgba(0,0,0,0.15); }
.question-btn.active { background: var(--yellow-rochelle); border-color: var(--yellow-rochelle); color: #0d2c4a; }
.question-btn:disabled, .question-btn:disabled:hover { background-color: #e9ecef; border-color: #ced4da; color: #adb5bd; cursor: not-allowed; transform: none; box-shadow: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23adb5bd' viewBox='0 0 16 16'%3E%3Cpath d='M8 1a2 2 0 0 1 2 2v4H6V3a2 2 0 0 1 2-2zm3 6V3a3 3 0 0 0-6 0v4a2 2 0 0 0-2 2v5a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: center left 15px; padding-left: 40px; }

#suggestion-popup { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%) scale(0.9); background-color: var(--blue-rochelle); color: white; padding: 20px 30px; border-radius: 12px; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25); display: flex; align-items: center; gap: 15px; z-index: 1100; opacity: 0; visibility: hidden; transition: all 0.3s ease-in-out; cursor: pointer; }
#suggestion-popup.visible { opacity: 1; visibility: visible; transform: translate(-50%, -50%) scale(1); }
#suggestion-popup.visible:hover { transform: translate(-50%, -50%) scale(1.05); }
#close-popup-btn { background: rgba(255, 255, 255, 0.2); color: white; border: none; border-radius: 50%; width: 24px; height: 24px; cursor: pointer; font-size: 16px; line-height: 24px; padding: 0; transition: background-color 0.3s; }
#close-popup-btn:hover { background: rgba(255, 255, 255, 0.4); }

.site-footer { margin-top: 60px; padding: 20px; text-align: center; color: #6c757d; border-top: 1px solid #ddd; font-size: 14px; background-color: white; flex-shrink: 0; }

#welcome-modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.7); z-index: 1000; display: flex; justify-content: center; align-items: center; opacity: 0; visibility: hidden; pointer-events: none; transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out; }
#welcome-modal-overlay.active { opacity: 1; visibility: visible; pointer-events: auto; }
#welcome-modal { background: white; padding: 30px 40px; border-radius: 12px; box-shadow: 0 5px 25px rgba(0,0,0,0.2); text-align: center; max-width: 500px; width: 90%; transform: scale(0.95); transition: transform 0.3s ease-in-out; }
#welcome-modal-overlay.active #welcome-modal { transform: scale(1); }
#welcome-modal h2 { color: var(--grey-text); margin-top: 0; }
#welcome-modal p { color: var(--grey-medium); font-size: 16px; line-height: 1.6; margin-bottom: 25px; }
#close-modal-btn { padding: 12px 30px; font-size: 16px; font-weight: 700; cursor: pointer; background: var(--yellow-rochelle); color: #0d2c4a; border: 2px solid var(--yellow-rochelle); border-radius: 50px; transition: all 0.3s ease; }
#close-modal-btn:hover { transform: scale(1.05); }

.scroll-down-arrow {
    margin-bottom: 20px;
    animation: bounce 2s infinite ease-in-out;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-8px); }
    60% { transform: translateY(-4px); }
}

/* --- Règles responsives --- */

@media (max-width: 768px) {
    .site-header h1 { font-size: 20px; }
    #main-container { padding: 25px 30px; margin-top: 30px; margin-bottom: 30px; }
    .character-panel h2 { font-size: 24px; }
    .question-btn {
        font-size: 15px;
        padding: 10px 20px;
    }

    .questions-panel {
        flex-direction: column;
        align-items: center;
    }

    .character-choice { width: 100px; padding: 8px; }
    .character-choice img { width: 70px; height: 70px; }
    .character-choice span { font-size: 13px; }
}

@media (max-width: 576px) {
    .site-header { flex-direction: column; text-align: center; padding: 15px; }
    .site-header img { margin-right: 0; margin-bottom: 10px; }
    
    #main-container {
        width: auto;
        margin-left: 15px;
        margin-right: 15px;
        padding: 25px 15px;
        margin-top: 20px;
        margin-bottom: 20px;
    }
    
    .character-panel h2 { font-size: 22px; }
    .questions-panel { gap: 10px; }
    .question-btn {
        width: 100%;
        padding: 14px;
    }
    .site-footer { margin-top: 40px; font-size: 12px; }
    
    #character-selector { gap: 10px; }
    .character-choice { width: auto; flex: 1; max-width: 110px; padding: 5px; }
    .character-choice img { width: 60px; height: 60px; }
    .character-choice span { font-size: 12px; line-height: 1.2; }

    #welcome-modal { padding: 25px 20px; }
    #welcome-modal p { font-size: 15px; }

    #suggestion-popup { width: 90%; max-width: 320px; padding: 15px 20px; font-size: 15px; text-align: center; flex-direction: column;}
}