/* Styles dédiés au jeu game-forecast */

/* Styles pour le message de limitation quotidienne */
.daily-limit-message {
    text-align: center;
    padding: 3rem;
    background: linear-gradient(135deg, #f5f0d7 0%, #fff8e1 100%);
    border: 2px solid #dcc8aa;
    border-radius: 20px;
    max-width: 600px;
    width: 100%;
    margin: 2rem auto;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    box-sizing: border-box;
    overflow-wrap: break-word;
    word-wrap: break-word;
    hyphens: auto;
}

.daily-limit-message .limit-icon {
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: center;
    gap: 0.5rem;
}

.daily-limit-message .title-pikto {
    width: 50px;
    height: 50px;
    opacity: 0.8;
    animation: float 3s ease-in-out infinite;
}

.daily-limit-message .title-pikto:nth-child(1) {
    animation-delay: 0s;
}

.daily-limit-message .title-pikto:nth-child(2) {
    animation-delay: 0.3s;
}

.daily-limit-message .title-pikto:nth-child(3) {
    animation-delay: 0.6s;
}

.daily-limit-message h3 {
    font-size: 2rem;
    margin-bottom: 1.5rem;
    background: linear-gradient(45deg, #fbbf24, #3b82f6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    overflow-wrap: break-word;
    word-wrap: break-word;
    hyphens: auto;
    line-height: 1.2;
    max-width: 100%;
}

.daily-limit-message .limit-text {
    font-size: 1.2rem;
    color: #555;
    margin: 1rem 0;
    line-height: 1.6;
    overflow-wrap: break-word;
    word-wrap: break-word;
    hyphens: auto;
    max-width: 100%;
}

.daily-limit-message .limit-decoration {
    margin-top: 2rem;
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.daily-limit-message .decoration-icon {
    width: 40px;
    height: 40px;
    opacity: 0.7;
    animation: float 3s ease-in-out infinite;
}

.daily-limit-message .decoration-icon:nth-child(1) {
    animation-delay: 0s;
}

.daily-limit-message .decoration-icon:nth-child(2) {
    animation-delay: 0.5s;
}

.daily-limit-message .decoration-icon:nth-child(3) {
    animation-delay: 1s;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

/* Styles pour l'explication de l'algorithme */
.algorithme-explication {
    max-width: 800px;
    margin: 2rem auto 0 auto;
    padding: 1.5rem 0;
    text-align: left;
}

.algorithme-explication summary {
    font-weight: 500;
    color: #666;
    font-size: 0.9rem;
    cursor: pointer;
    padding: 0.5rem 0 0.5rem 2rem;
    margin-bottom: 1rem;
    font-style: italic;
}

.algorithme-explication summary:hover {
    color: #3b82f6;
}

.algorithme-explication p {
    color: #666;
    font-size: 0.9rem;
    font-weight: 400;
    line-height: 1.6;
    margin: 1rem 0;
    padding-left: 2rem;
    text-align: left;
}

.algorithme-explication p:last-child {
    margin-bottom: 0;
}

.algorithme-actions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin: 1.5rem auto;
    padding: 0 2rem;
    max-width: 800px;
    align-items: center;
    text-align: center;
}

.algorithme-explication .screenshot-tip-inline,
.screenshot-tip-inline {
    color: #3b82f6;
    font-size: 0.85rem;
    font-style: italic;
    font-weight: 500;
    margin: 0;
    padding: 0.5rem 1rem;
    background: rgba(59, 130, 246, 0.05);
    border-left: 3px solid #3b82f6;
    border-radius: 4px;
    text-align: center;
}

.btn-restart-test {
    background: linear-gradient(45deg, #fbbf24, #3b82f6);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 3px 10px rgba(59, 130, 246, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    align-self: center;
}

.btn-restart-test:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(59, 130, 246, 0.4);
}

.btn-restart-test:active {
    transform: translateY(0);
}

.algorithme-explication .author-link {
    color: #3b82f6;
    text-decoration: none;
    font-weight: 500;
}

.algorithme-explication .author-link:hover {
    text-decoration: underline;
    color: #5b21b6;
}

/* Styles pour les liens externes */
.external-link {
    color: #3b82f6;
    text-decoration: none;
    font-weight: normal !important;
    font-family: 'Arial', sans-serif !important;
    font-style: normal !important;
}

.external-link:hover {
    text-decoration: underline;
    color: #5b21b6;
}

.forecast-section {
    background: rgba(245, 240, 215, 0.9);
    border: 2px solid rgba(220, 200, 170, 0.8);
    border-radius: 20px;
    padding: 3rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

.forecast-section h2 {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 1rem;
    background: linear-gradient(45deg, #fbbf24, #3b82f6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nergo-subtitle {
    text-align: center;
    font-size: 1.2rem;
    color: #666;
    margin: 0 auto 2rem auto;
    max-width: 600px;
    line-height: 1.5;
    font-style: italic;
    padding: 0 1rem;
}

.game-forecast-container {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    justify-content: center;
    align-items: center;
}

.game-forecast {
    background: transparent;
    border: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.game-intro {
    text-align: center;
}

.game-intro p {
    font-size: 1.2rem;
    color: #666;
    margin-bottom: 2rem;
}

.btn-start {
    background: linear-gradient(45deg, #fbbf24, #3b82f6);
    color: white;
    border: none;
    padding: 1rem 3rem;
    border-radius: 50px;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(251, 191, 36, 0.3);
}

.btn-start:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(251, 191, 36, 0.4);
}

/* Styles pour les étapes du jeu */
.game-step {
    display: none;
    text-align: center;
}

.game-step.active {
    display: block;
    animation: fadeIn 0.5s ease-in-out;
}

.game-step h3 {
    color: #3b82f6;
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
}

/* Titre de l'étape 3 avec dégradé bleu jaune */
.step3-title {
    background: linear-gradient(45deg, #fbbf24, #3b82f6) !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    background-clip: text !important;
    margin-bottom: 0.5rem !important;
}

/* Instruction étape 3 avec espacement réduit */
.step3-instruction {
    margin-top: 0 !important;
    margin-bottom: 1.5rem !important;
}

.choices-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 1rem;
    margin: 2rem auto;
    justify-items: center;
    justify-content: center;
    width: 100%;
    max-width: 600px;
    box-sizing: border-box;
}

.choice-item {
    background: rgba(252, 250, 240, 0.95);
    border: 3px solid rgba(200, 180, 150, 0.8);
    border-radius: 15px;
    padding: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
    box-sizing: border-box;
    width: 100px;
    height: 100px;
    position: relative;
    overflow: hidden;
}

.choice-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 10px;
}

/* Disposition circulaire pour les étapes 1 et 2 */
.choices-grid.circular {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    width: 400px;
    height: 400px;
    margin: 2rem auto;
}

.choices-grid.circular .choice-item {
    position: absolute;
    min-width: 80px;
    max-width: 80px;
    height: 80px;
}

/* Disposition matricielle pour l'étape 3 */
.choices-grid.matrix-step3 {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    max-width: 600px;
    margin: 2rem auto;
}

.matrix-row-top,
.matrix-row-bottom {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.8rem;
    justify-items: center;
}

.matrix-main {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    grid-template-rows: repeat(4, 1fr);
    gap: 0.8rem;
    justify-items: center;
}

.matrix-step3 .choice-item {
    min-width: 70px;
    max-width: 70px;
    height: 70px;
}

/* Grilles adaptatives selon le nombre d'éléments */
.choices-grid.items-7 { 
    grid-template-columns: repeat(3, 1fr);
    max-width: 360px;
}

.choices-grid.items-6 { 
    grid-template-columns: repeat(3, 1fr);
    max-width: 360px;
}

.choices-grid.items-5 { 
    grid-template-columns: repeat(3, 1fr);
    max-width: 360px;
}

.choices-grid.items-4 { 
    grid-template-columns: repeat(2, 1fr);
    max-width: 240px;
}

.choices-grid.items-3 { 
    grid-template-columns: repeat(3, 1fr);
    max-width: 360px;
}

.choices-grid.items-2 { 
    grid-template-columns: repeat(2, 1fr);
    max-width: 240px;
}

.choices-grid.items-1 { 
    grid-template-columns: 1fr;
    max-width: 120px;
}

/* Pour l'étape 3 avec 26 pictogrammes */
.choices-grid.items-26 {
    grid-template-columns: repeat(6, 1fr);
    max-width: 660px;
    gap: 0.8rem;
}

.choices-grid.items-25 {
    grid-template-columns: repeat(5, 1fr);
    max-width: 560px;
}

/* Disposition multirow pour l'étape 3 (4-5-6-5-4-3) */
.choices-grid-multirow {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    margin: 2rem auto;
    max-width: 100%;
}

.pikto-row {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: nowrap;
}

.pikto-row .choice-item {
    width: 65px;
    height: 65px;
    min-width: 65px;
    flex-shrink: 0;
}

.pikto-row .choice-item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.choice-item:hover {
    border-color: #3b82f6;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(59, 130, 246, 0.2);
}

.choice-item.flipped {
    opacity: 0.3;
    transform: rotateY(180deg);
}

.choice-item.flipped img {
    visibility: hidden;
}

.choice-item.blocked {
    opacity: 0.5;
    cursor: not-allowed;
    border-color: #ccc;
}

.choice-item.blocked:hover {
    transform: none;
    box-shadow: none;
    border-color: #ccc;
}

.choice-item.selected {
    background: linear-gradient(45deg, #fbbf24, #3b82f6);
    color: white;
    border-color: #3b82f6;
}

.game-controls {
    margin-top: 2rem;
    text-align: center;
}

.btn-next {
    background: linear-gradient(45deg, #28a745, #20c997);
    color: white;
    border: none;
    padding: 0.8rem 2rem;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 0 auto;
    display: block;
    /* Amélioration pour mobile */
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    touch-action: manipulation;
}

.btn-next:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(40, 167, 69, 0.3);
}

.btn-next:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ========================================
   RÉSULTAT - ENCADRÉ
   ======================================== */

.result-box {
    background: rgba(252, 250, 240, 0.9);
    border: 2px solid rgba(200, 180, 150, 0.8);
    border-radius: clamp(10px, 1.5vw, 15px);
    padding: 3%;
    margin: 0 auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    width: min(90vh * 0.75, 95vw);
    max-width: 1050px;
    aspect-ratio: 3/4;
    box-sizing: border-box;
    display: grid;
    grid-template-rows: auto 1fr auto;
    gap: 1%;
    overflow: hidden;
}

.header-container {
    display: flex;
    flex-direction: column;
    gap: 0.3%;
    width: 100%;
}

.result-title {
    font-size: clamp(1rem, 2vw, 1.5rem);
    margin: 0;
    text-align: center;
    background: linear-gradient(45deg, #fbbf24, #3b82f6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: bold;
    line-height: 1.2;
}

.result-date {
    text-align: center;
    font-size: clamp(0.75rem, 1.5vw, 0.95rem);
    color: #666;
    margin: 0;
    font-weight: 500;
}

.analysis-text {
    font-size: 0.95rem;
    color: #333;
    font-weight: 500;
    margin: 0;
    line-height: 1.5;
    text-align: justify;
    hyphens: auto;
    word-wrap: break-word;
}

/* Question du moment avec pikto inline */
.question-moment {
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(0.3rem, 0.8vw, 0.5rem);
    flex-wrap: wrap;
    margin-top: clamp(1rem, 2vw, 1.5rem);
    margin-bottom: clamp(0.3rem, 0.8vw, 0.5rem);
    font-size: clamp(0.85rem, 1.5vw, 1rem);
}

.question-answer {
    text-align: center;
    font-size: clamp(0.95rem, 1.8vw, 1.2rem);
    margin: clamp(0.3rem, 0.8vw, 0.5rem) auto clamp(0.8rem, 1.5vw, 1rem) auto;
    max-width: 100%;
}

.pikto-inline {
    width: clamp(20px, 4vw, 30px) !important;
    height: clamp(20px, 4vw, 30px) !important;
    vertical-align: middle;
    display: inline-block;
    margin: 0 clamp(0.1rem, 0.4vw, 0.25rem);
}

.key-phrase {
    margin-bottom: 1rem;
    font-size: 1rem;
    line-height: 1.6;
    text-align: center;
}

.tips-section {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.tip-item {
    font-size: 0.9rem;
    line-height: 1.3;
    padding-left: 0.5rem;
}

/* Animation pour l'apparition */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Responsive pour forecast */
@media (max-width: 768px) {
    .forecast-section {
        padding: 2rem 1rem;
        margin: 1rem 0;
    }

    .forecast-section h2 {
        font-size: 1.6rem;
    }

    .btn-restart-test {
        font-size: 0.9rem;
        padding: 0.7rem 1.2rem;
    }

    .algorithme-actions {
        gap: 0.75rem;
    }

    .choices-grid {
        grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
        gap: 0.8rem;
        margin: 2rem auto;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    /* Amélioration des boutons sur mobile */
    .btn-next {
        padding: 1rem 2rem;
        font-size: 1.1rem;
        min-height: 48px; /* Taille minimum recommandée pour touch */
        width: auto;
        min-width: 150px;
    }

    .choice-item {
        width: 80px;
        height: 80px;
        padding: 0.4rem;
        font-size: 0.8rem;
    }

    /* Responsive pour disposition multirow sur tablette */
    .pikto-row {
        gap: 0.8rem;
    }

    .pikto-row .choice-item {
        width: 50px;
        height: 50px;
        min-width: 50px;
    }

    /* Grilles adaptatives pour mobile */
    .choices-grid.items-7,
    .choices-grid.items-6,
    .choices-grid.items-5 { 
        grid-template-columns: repeat(3, 1fr);
        max-width: 270px;
    }

    .choices-grid.items-4,
    .choices-grid.items-3,
    .choices-grid.items-2 { 
        grid-template-columns: repeat(2, 1fr);
        max-width: 180px;
    }

    .choices-grid.items-1 { 
        grid-template-columns: 1fr;
        max-width: 90px;
    }

    .choices-grid.items-26 {
        grid-template-columns: repeat(4, 1fr);
        max-width: 340px;
        gap: 0.6rem;
    }

    .choices-grid.items-25 {
        grid-template-columns: repeat(4, 1fr);
        max-width: 340px;
    }

    /* Styles responsive pour l'affichage du résultat - tablettes */
    /* Les styles sont maintenant gérés par clamp() dans les règles principales */

    /* Style mobile pour le message de limite quotidienne */
    .daily-limit-message {
        padding: 2rem 1rem;
        margin: 1.5rem auto;
        max-width: 90%;
        width: calc(100% - 2rem);
    }

    .daily-limit-message h3 {
        font-size: 1.6rem;
        line-height: 1.3;
        margin-bottom: 1.2rem;
    }

    .daily-limit-message .limit-text {
        font-size: 1.1rem;
        padding: 0 0.5rem;
    }
}

@media (max-width: 480px) {
    .forecast-section {
        padding: 1.5rem 0.5rem;
    }

    .forecast-section h2 {
        font-size: 1.15rem;
    }

    .btn-start {
        padding: 0.8rem 1.5rem;
        font-size: 1rem;
    }

    .btn-restart-test {
        font-size: 0.85rem;
        padding: 0.65rem 1rem;
    }

    .algorithme-actions {
        gap: 0.6rem;
    }

    /* Style mobile très petit écran pour le message de limite quotidienne */
    .daily-limit-message {
        padding: 1.5rem 0.8rem;
        margin: 1rem auto;
        max-width: 95%;
        width: calc(100% - 1rem);
        min-height: auto;
    }

    .daily-limit-message h3 {
        font-size: 1.3rem;
        line-height: 1.4;
        margin-bottom: 1rem;
        padding: 0 0.2rem;
    }

    .daily-limit-message .limit-text {
        font-size: 1rem;
        line-height: 1.5;
        padding: 0 0.2rem;
        word-break: break-word;
    }

    .choices-grid {
        grid-template-columns: repeat(auto-fit, minmax(70px, 1fr));
        gap: 0.6rem;
        margin: 1.5rem auto;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    .choice-item {
        width: 70px;
        height: 70px;
        padding: 0.3rem;
        font-size: 0.7rem;
    }

    /* Responsive pour disposition multirow sur mobile */
    .choices-grid-multirow {
        gap: 0.6rem;
    }

    .pikto-row {
        gap: 0.5rem;
    }

    .pikto-row .choice-item {
        width: 40px;
        height: 40px;
        min-width: 40px;
        padding: 0.2rem;
    }

    /* Grilles adaptatives pour très petit mobile */
    .choices-grid.items-7,
    .choices-grid.items-6,
    .choices-grid.items-5 { 
        grid-template-columns: repeat(3, 1fr);
        max-width: 230px;
    }

    .choices-grid.items-4,
    .choices-grid.items-3,
    .choices-grid.items-2 { 
        grid-template-columns: repeat(2, 1fr);
        max-width: 154px;
    }

    .choices-grid.items-1 { 
        grid-template-columns: 1fr;
        max-width: 77px;
    }

    .choices-grid.items-26 {
        grid-template-columns: repeat(3, 1fr);
        max-width: 245px;
        gap: 0.5rem;
    }

    .choices-grid.items-25 {
        grid-template-columns: repeat(3, 1fr);
        max-width: 245px;
    }

    /* Styles responsive pour l'affichage du résultat - mobile */
    .result-box {
        padding: 1.5rem 1rem;
        max-width: 95%;
        aspect-ratio: 3/4;
    }

    .result-title {
        font-size: 0.9rem;
        margin-bottom: 1rem;
        line-height: 1.3;
    }

    /* Tailles de police et dimensions gérées par clamp() dans les règles principales */
    .result-date {
        display: block;
    }
}

/* ========================================
   NUAGE DE MOTS
   ======================================== */

.word-cloud {
    position: relative;
    width: 94%;
    max-width: calc(100% - 6%);
    aspect-ratio: 1/1;
    margin: auto;
    background-image: url('../images/nuage.png?v=6');
    background-size: 100% 100%;
    background-position: center;
    background-repeat: no-repeat;
    /* Taille de base pour les mots - scalera avec le conteneur */
    font-size: clamp(9px, 2.3vw, 15px);
    flex-shrink: 1;
    flex-grow: 0;
    align-self: center;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Pictogramme centré - MASQUÉ pour l'instant */
.word-cloud > img:first-child {
    display: none;
}

/* Mots en ovale - tailles relatives au conteneur word-cloud */
.word-tag {
    position: absolute;
    padding: 0.05em 0.15em;
    white-space: nowrap;
    cursor: default;
    transition: transform 0.2s ease;
    /* La taille de base est héritée du word-cloud, et modifiée par JS avec des pourcentages */
}

.word-tag:hover {
    transform: scale(1.15);
    z-index: 15;
}

/* Les positions des mots sont gérées dynamiquement par word-cloud-layout.js */
/* Cela permet un placement sans superposition avec des tailles et polices variées */

@media (max-width: 768px) {
    /* Dimensions gérées par clamp() dans les règles principales */
    .word-cloud {
        overflow: hidden;
    }
}