/* ===== DAY 5 - TEMPLE STATUETTES - FORCE 2x3 ABSOLUTE ===== */
/* This file has absolute priority to force the 2x3 grid on day 5 */

/* ===== SHOW INDICATOR ONLY ON LARGE SCREENS ===== */
@media screen and (min-width: 769px) {
    /* Show arrow only on desktop */
    .rotation-indicator {
        display: block !important;
    }
    
    .rotation-indicator .arrow {
        display: block !important;
    }
}

/* ===== ULTRA HIGH SPECIFICITY - PORTRAIT MODE ===== */
@media screen and (max-width: 768px) and (orientation: portrait) {
    /* Maximum specificity to override any other rule */
    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;
        
        /* Prevent any grid changes */
        grid-auto-flow: row !important;
        grid-template: repeat(3, auto) / repeat(2, 1fr) !important;
    }
}

/* ===== SMALL SCREENS 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;
        
        /* Absolute force */
        grid-template: repeat(3, auto) / repeat(2, 1fr) !important;
    }
}

/* ===== VERY SMALL SCREENS 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;
        
        /* Maximum force even on smallest screens */
        grid-template: repeat(3, auto) / repeat(2, 1fr) !important;
    }
}

/* ===== LANDSCAPE MODE - KEEP 2x3 (not 3x2!) ===== */
@media screen and (max-width: 768px) and (orientation: landscape) {
    /* Total override of mobile-improvements.css which sets 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 even in landscape */
        grid-template: repeat(3, auto) / repeat(2, 1fr) !important;
    }
    
    /* Prevent container from forcing height */
    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 SMALL LANDSCAPE SCREENS ===== */
@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 even on small landscape screens */
        grid-template: repeat(3, auto) / repeat(2, 1fr) !important;
    }
}

/* ===== HIDE INDICATORS ON SMALL SCREENS ===== */
@media screen and (max-width: 768px) {
    /* Completely remove the directional arrow */
    .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;
    }
    
    /* Specifically remove the arrow */
    .arrow {
        display: none !important;
    }
}

/* ===== COMPACT STATUETTE ELEMENTS - RESPONSIVE ===== */
@media screen and (max-width: 768px) {
    /* Statuette styles adapted to 2x3 grid - COMPACT VERSION */
    .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;
    }
}

/* ===== ADJUSTMENTS FOR VERY SMALL SCREENS ===== */
@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 SMALL SCREENS (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;
    }
}

/* ===== REDUCTION OF ENTIRE TEMPLE ===== */
@media screen and (max-width: 768px) {
    /* Reduce header and temple elements */
    .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;
    }
    
    /* Smaller fireplace and doors */
    .temple-fireplace {
        margin: 5px 0 !important;
        transform: scale(0.8) !important;
    }
    
    .temple-doors {
        margin: 5px 0 !important;
        transform: scale(0.8) !important;
    }
    
    /* Smaller action buttons */
    .descriptions-toggle button {
        padding: 6px 10px !important;
        font-size: 0.8rem !important;
    }
    
    /* Compact descriptions area */
    .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;
    }
}