/* --- BỐ CỤC XƯỞNG ROBOT --- */
.factory-arena {
    height: 220px;
    background: linear-gradient(180deg, #263238 0%, #37474f 100%);
    box-shadow: inset 0 0 20px rgba(0,0,0,0.8);
    position: relative; 
    overflow: hidden;
}

/* Nền sàn công nghệ lưới */
.factory-floor-bg {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background-image: 
        linear-gradient(rgba(0, 188, 212, 0.2) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 188, 212, 0.2) 1px, transparent 1px);
    background-size: 20px 20px;
    z-index: 1;
}

/* Bệ lắp ráp trung tâm */
.assembly-station {
    position: absolute;
    top: 55%; left: 60%;
    transform: translate(-50%, -50%);
    width: 120px; height: 140px;
    border-bottom: 5px solid #00bcd4;
    border-radius: 5px;
    box-shadow: 0 10px 15px rgba(0,255,255,0.1);
    z-index: 2;
    display: flex;
    justify-content: center;
    align-items: flex-end;
}

/* Robot bản vẽ (mờ, chờ kích hoạt) */
.robot-blueprint {
    font-size: 4rem;
    filter: drop-shadow(0 0 5px rgba(0, 188, 212, 0.5)) grayscale(100%) opacity(0.5);
    margin-bottom: 10px;
    transition: all 1s ease;
}

/* Hiệu ứng khi Robot được kích hoạt */
.robot-activate {
    animation: power-on 1.2s forwards !important;
}
@keyframes power-on {
    0% { filter: grayscale(100%) opacity(0.5); transform: translateY(0); }
    50% { filter: drop-shadow(0 0 20px #00bcd4) grayscale(0%) opacity(1); transform: translateY(-20px); }
    100% { filter: drop-shadow(0 5px 10px #00bcd4) grayscale(0%) opacity(1); transform: translateY(0); }
}

/* Lỗi chập điện khi tính sai */
.error-glitch {
    animation: glitch-red 0.3s infinite alternate;
}
@keyframes glitch-red {
    0% { filter: drop-shadow(0 0 10px #f44336) sepia(100%) hue-rotate(-50deg); transform: skewX(-5deg); }
    100% { filter: drop-shadow(0 0 20px #f44336) sepia(100%) hue-rotate(-50deg); transform: skewX(5deg); }
}

/* Các linh kiện lơ lửng xung quanh bệ */
.item-floating {
    position: absolute;
    font-size: 1.5rem;
    opacity: 0.7;
    animation: float-obj 3s ease-in-out infinite alternate;
}
.item-floating:nth-child(2) { top: 20px; left: -10px; }
.item-floating:nth-child(3) { top: 10px; right: -10px; animation-delay: 0.5s; }
.item-floating:nth-child(4) { top: 60px; right: -20px; animation-delay: 1s; }

@keyframes float-obj {
    0% { transform: translateY(0); }
    100% { transform: translateY(-10px); }
}

/* Nhân vật Kỹ sư */
.engineer-char {
    position: absolute;
    bottom: 20px;
    left: 15%;
    font-size: 4.5rem;
    z-index: 5;
    filter: drop-shadow(0 5px 5px rgba(0,0,0,0.6));
}

/* 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(-30px) 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(-15px) rotate(-10deg); }
    50% { transform: translateX(15px) rotate(10deg); }
    75% { transform: translateX(-15px) rotate(-10deg); }
    100% { transform: translateX(0); }
}

.min-h-75 { min-height: 85px; }