/* --- BỐ CỤC NHÀ MÁY --- */
.factory-arena {
    height: 220px;
    background: linear-gradient(180deg, #b0bec5 0%, #78909c 100%);
    box-shadow: inset 0 0 20px rgba(0,0,0,0.5);
    position: relative; 
    overflow: hidden;
}

/* Băng chuyền cuộn ngang */
.conveyor-belt {
    position: absolute;
    bottom: 0; left: 0;
    width: 200%; height: 35px;
    background: repeating-linear-gradient(
        -45deg,
        #424242,
        #424242 20px,
        #212121 20px,
        #212121 40px
    );
    animation: belt-move 3s linear infinite;
    border-top: 5px solid #000;
    z-index: 1;
}
@keyframes belt-move {
    0% { transform: translateX(0); }
    100% { transform: translateX(-56px); /* Kích thước lặp chu kỳ */ }
}

/* Base cho khối 3D */
.box-3d {
    position: absolute;
    top: 55%; left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
    animation: drop-box 0.4s ease-out forwards;
}

/* --- VẼ KHỐI LẬP PHƯƠNG BẰNG CSS --- */
.lapphuong .face-front {
    width: 70px; height: 70px;
    background: #ffb74d; border: 2px solid #e65100;
    position: absolute; top: 0; left: 0;
}
.lapphuong .face-top {
    width: 70px; height: 25px;
    background: #ffcc80; border: 2px solid #e65100;
    position: absolute; top: -25px; left: 0;
    transform: skewX(-45deg); transform-origin: bottom left;
}
.lapphuong .face-right {
    width: 25px; height: 70px;
    background: #f57c00; border: 2px solid #e65100;
    position: absolute; top: 0; left: 70px;
    transform: skewY(-45deg); transform-origin: top left;
}

/* --- VẼ KHỐI HỘP CHỮ NHẬT BẰNG CSS --- */
.hopchunhat .face-front {
    width: 110px; height: 60px;
    background: #4fc3f7; border: 2px solid #01579b;
    position: absolute; top: 0; left: -20px;
}
.hopchunhat .face-top {
    width: 110px; height: 25px;
    background: #81d4fa; border: 2px solid #01579b;
    position: absolute; top: -25px; left: -20px;
    transform: skewX(-45deg); transform-origin: bottom left;
}
.hopchunhat .face-right {
    width: 25px; height: 60px;
    background: #03a9f4; border: 2px solid #01579b;
    position: absolute; top: 0; left: 90px;
    transform: skewY(-45deg); transform-origin: top left;
}

/* Hiệu ứng thả khối vào băng chuyền */
@keyframes drop-box {
    0% { transform: translate(-50%, -200%); opacity: 0; }
    100% { transform: translate(-50%, -50%); opacity: 1; }
}

/* Hiệu ứng trôi đi khi đúng */
.box-leave {
    animation: slide-away 1s ease-in forwards !important;
}
@keyframes slide-away {
    0% { transform: translate(-50%, -50%); opacity: 1; }
    100% { transform: translate(-250%, -50%); opacity: 0; }
}

/* Nhân vật Công nhân */
.worker-char {
    position: absolute;
    bottom: 50px;
    right: 15%;
    font-size: 3.5rem;
    z-index: 5;
    filter: drop-shadow(2px 2px 2px rgba(0,0,0,0.5));
}

/* Nhảy mừng */
.happy-jump {
    animation: build-jump 0.8s ease-out forwards !important;
}
@keyframes build-jump {
    0% { transform: translateY(0); }
    50% { transform: translateY(-40px) scale(1.1); }
    100% { transform: translateY(0); }
}

/* Rung lắc khi sai */
.shake-error { animation: shake-char 0.4s !important; }
@keyframes shake-char {
    0% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    50% { transform: translateX(10px); }
    75% { transform: translateX(-10px); }
    100% { transform: translateX(0); }
}

.min-h-75 { min-height: 85px; }