/* ===== JOUR 5 - TEMPLE STATUETTES - FORCER 2x3 ABSOLU ===== */
/* Ce fichier a la priorité absolue pour forcer la grille 2x3 sur le jour 5 */

/* ===== AFFICHER INDICATEUR SEULEMENT SUR GRANDS ÉCRANS ===== */
@media screen and (min-width: 769px) {
    /* Afficher la flèche uniquement sur desktop */
    .rotation-indicator {
        display: block !important;
    }
    
    .rotation-indicator .arrow {
        display: block !important;
    }
}

/* ===== ULTRA HAUTE SPÉCIFICITÉ - MODE PORTRAIT ===== */
@media screen and (max-width: 768px) and (orientation: portrait) {
    /* Spécificité maximum pour écraser toute autre règle */
    html body #app .main-content .view .enigma-container .temple-container .temple-grid,
    html body #app .main-content .view .temple-container .temple-grid,
    html body #app .temple-container .temple-grid,
    html body .temple-container .temple-grid,
    body .temple-grid {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        grid-template-rows: repeat(3, auto) !important;
        gap: 6px !important;
        max-width: 280px !important;
        width: 100% !important;
        margin: 8px auto !important;
        padding: 0 !important;
        box-sizing: border-box !important;
        
        /* Empêcher tout changement de grille */
        grid-auto-flow: row !important;
        grid-template: repeat(3, auto) / repeat(2, 1fr) !important;
    }
}

/* ===== PETITS ÉCRANS PORTRAIT ===== */
@media screen and (max-width: 480px) and (orientation: portrait) {
    html body #app .main-content .view .enigma-container .temple-container .temple-grid,
    html body #app .main-content .view .temple-container .temple-grid,
    html body #app .temple-container .temple-grid,
    html body .temple-container .temple-grid,
    body .temple-grid {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        grid-template-rows: repeat(3, auto) !important;
        gap: 4px !important;
        max-width: 240px !important;
        width: 100% !important;
        margin: 5px auto !important;
        padding: 0 !important;
        
        /* Force absolue */
        grid-template: repeat(3, auto) / repeat(2, 1fr) !important;
    }
}

/* ===== TRÈS PETITS ÉCRANS PORTRAIT (Galaxy Fold, etc.) ===== */
@media screen and (max-width: 320px) and (orientation: portrait) {
    html body #app .main-content .view .enigma-container .temple-container .temple-grid,
    html body #app .main-content .view .temple-container .temple-grid,
    html body #app .temple-container .temple-grid,
    html body .temple-container .temple-grid,
    body .temple-grid {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        grid-template-rows: repeat(3, auto) !important;
        gap: 3px !important;
        max-width: 200px !important;
        width: 100% !important;
        margin: 3px auto !important;
        padding: 0 !important;
        
        /* Force maximale même sur les plus petits écrans */
        grid-template: repeat(3, auto) / repeat(2, 1fr) !important;
    }
}

/* ===== MODE PAYSAGE - GARDER 2x3 (pas 3x2 !) ===== */
@media screen and (max-width: 768px) and (orientation: landscape) {
    /* Override total de mobile-improvements.css qui met en 3x2 */
    html body #app .main-content .view .enigma-container .temple-container .temple-grid,
    html body #app .main-content .view .temple-container .temple-grid,
    html body #app .temple-container .temple-grid,
    html body .temple-container .temple-grid,
    body .temple-grid {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        grid-template-rows: repeat(3, auto) !important;
        gap: 8px !important;
        max-width: 380px !important;
        width: 100% !important;
        margin: 8px auto !important;
        padding: 0 !important;
        
        /* Force 2x3 même en paysage */
        grid-template: repeat(3, auto) / repeat(2, 1fr) !important;
    }
    
    /* Empêcher le container de forcer la hauteur */
    html body #app .main-content .view .enigma-container .temple-container,
    html body #app .main-content .view .temple-container,
    html body .temple-container {
        max-height: none !important;
        overflow: visible !important;
    }
}

/* ===== ULTRA PETITS ÉCRANS PAYSAGE ===== */
@media screen and (max-width: 480px) and (orientation: landscape) {
    html body #app .main-content .view .enigma-container .temple-container .temple-grid,
    html body #app .main-content .view .temple-container .temple-grid,
    html body #app .temple-container .temple-grid,
    html body .temple-container .temple-grid,
    body .temple-grid {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        grid-template-rows: repeat(3, auto) !important;
        gap: 6px !important;
        max-width: 320px !important;
        width: 100% !important;
        margin: 6px auto !important;
        padding: 0 !important;
        
        /* Force 2x3 même sur petits écrans paysage */
        grid-template: repeat(3, auto) / repeat(2, 1fr) !important;
    }
}

/* ===== ÉLÉMENTS STATUETTES - RESPONSIVE COMPACT ===== */
@media screen and (max-width: 768px) {
    /* Styles des statuettes adaptés à la grille 2x3 - VERSION COMPACTE */
    .statuette-item {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 4px !important;
        min-height: 85px !important;
        background: white !important;
        border: 1px solid #ddd !important;
        border-radius: 4px !important;
        box-sizing: border-box !important;
    }
    
    .statuette-image-container {
        width: 35px !important;
        height: 35px !important;
        margin-bottom: 2px !important;
        position: relative !important;
    }
    
    .statuette-img {
        width: 100% !important;
        height: 100% !important;
        object-fit: contain !important;
    }
    
    .rotation-indicator {
        display: none !important;
    }
    
    .orientation-controls {
        display: flex !important;
        align-items: center !important;
        gap: 2px !important;
        margin: 2px 0 !important;
    }
    
    .rotate-btn {
        width: 16px !important;
        height: 16px !important;
        font-size: 9px !important;
        background: #c9a646 !important;
        color: white !important;
        border: none !important;
        border-radius: 50% !important;
        cursor: pointer !important;
        padding: 0 !important;
    }
    
    .rotation-display {
        font-size: 8px !important;
        min-width: 20px !important;
        text-align: center !important;
    }
    
    .statuette-name-input {
        width: 65px !important;
        max-width: 65px !important;
        padding: 2px !important;
        font-size: 9px !important;
        text-align: center !important;
        border: 1px solid #ddd !important;
        border-radius: 2px !important;
        margin-top: 2px !important;
    }
    
    .position-label {
        font-size: 7px !important;
        color: #666 !important;
        margin-top: 1px !important;
    }
}

/* ===== AJUSTEMENTS POUR TRÈS PETITS ÉCRANS ===== */
@media screen and (max-width: 480px) {
    .statuette-item {
        min-height: 75px !important;
        padding: 3px !important;
    }
    
    .statuette-image-container {
        width: 30px !important;
        height: 30px !important;
    }
    
    .rotate-btn {
        width: 14px !important;
        height: 14px !important;
        font-size: 8px !important;
    }
    
    .rotation-display {
        font-size: 7px !important;
        min-width: 18px !important;
    }
    
    .statuette-name-input {
        width: 55px !important;
        max-width: 55px !important;
        font-size: 8px !important;
        padding: 1px !important;
    }
    
    .position-label {
        font-size: 6px !important;
    }
}

/* ===== ULTRA PETITS ÉCRANS (Galaxy Fold) ===== */
@media screen and (max-width: 320px) {
    .statuette-item {
        min-height: 65px !important;
        padding: 2px !important;
    }
    
    .statuette-image-container {
        width: 25px !important;
        height: 25px !important;
    }
    
    .rotate-btn {
        width: 12px !important;
        height: 12px !important;
        font-size: 7px !important;
    }
    
    .rotation-display {
        font-size: 6px !important;
        min-width: 15px !important;
    }
    
    .statuette-name-input {
        width: 45px !important;
        max-width: 45px !important;
        font-size: 7px !important;
        padding: 1px !important;
    }
    
    .position-label {
        font-size: 5px !important;
    }
}

/* ===== MASQUER INDICATEURS SUR PETITS ÉCRANS ===== */
@media screen and (max-width: 768px) {
    /* Supprimer complètement la flèche directionnelle */
    .rotation-indicator,
    .rotation-indicator .arrow,
    .statuette-item .rotation-indicator,
    .statuette-image-container .rotation-indicator,
    [id^="indicator-"] {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
    }
    
    /* Supprimer spécifiquement la flèche */
    .arrow {
        display: none !important;
    }
}

/* ===== RÉDUCTION DU TEMPLE ENTIER ===== */
@media screen and (max-width: 768px) {
    /* Réduire l'en-tête et les éléments du temple */
    .statuettes-header h3 {
        font-size: 1.2rem !important;
        margin: 5px 0 !important;
    }
    
    .statuettes-subtitle {
        font-size: 0.8rem !important;
        margin: 3px 0 !important;
    }
    
    .story-card {
        padding: 6px !important;
        margin: 5px 0 !important;
        background: white !important;
    }
    
    .story-card h4 {
        font-size: 0.9rem !important;
        margin: 2px 0 !important;
    }
    
    .story-card p {
        font-size: 0.7rem !important;
        margin: 2px 0 !important;
    }
    
    /* Cheminée et portes plus petites */
    .temple-fireplace {
        margin: 5px 0 !important;
        transform: scale(0.8) !important;
    }
    
    .temple-doors {
        margin: 5px 0 !important;
        transform: scale(0.8) !important;
    }
    
    /* Boutons d'action plus petits */
    .descriptions-toggle button {
        padding: 6px 10px !important;
        font-size: 0.8rem !important;
    }
    
    /* Zone de descriptions compacte */
    .descriptions-grid {
        gap: 4px !important;
    }
    
    .description-card {
        padding: 4px !important;
        font-size: 0.7rem !important;
    }
}

@media screen and (max-width: 480px) {
    .statuettes-header h3 {
        font-size: 1rem !important;
    }
    
    .statuettes-subtitle {
        font-size: 0.7rem !important;
    }
    
    .story-card {
        padding: 4px !important;
        background: white !important;
    }
    
    .story-card h4 {
        font-size: 0.8rem !important;
    }
    
    .story-card p {
        font-size: 0.6rem !important;
    }
    
    .temple-fireplace,
    .temple-doors {
        transform: scale(0.7) !important;
    }
}

@media screen and (max-width: 320px) {
    .statuettes-header h3 {
        font-size: 0.9rem !important;
    }
    
    .statuettes-subtitle {
        font-size: 0.6rem !important;
    }
    
    .story-card p {
        font-size: 0.5rem !important;
    }
    
    .temple-fireplace,
    .temple-doors {
        transform: scale(0.6) !important;
    }
    
    .descriptions-toggle button {
        padding: 4px 6px !important;
        font-size: 0.7rem !important;
    }
}