/* 原有 CSS 保持不變 */
#battle-view {
    background-image: url('../img/battle.JPG');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    min-height: 700px;
    position: relative;
    padding: 20px;
    color: #fff;
}

#battle-view::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 0;
}

#battle-view .header,
#battle-view .battle-field {
    position: relative;
    z-index: 1;
}

#battle-title {
    color: #fff;
    text-shadow: 2px 2px 5px rgba(0, 0, 0, 0.8);
    font-size: 2.5rem;
    margin-bottom: 30px;
}

.battle-field {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
    background-color: rgba(0, 0, 0, 0.7);
    border-radius: 10px;
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.army {
    width: 30%;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    background-color: rgba(0, 0, 0, 0.5);
}

.attacker {
    border: 2px solid rgba(0, 255, 0, 0.5);
    box-shadow: 0 0 15px rgba(0, 255, 0, 0.3);
}

.defender {
    border: 2px solid rgba(255, 0, 0, 0.5);
    box-shadow: 0 0 15px rgba(255, 0, 0, 0.3);
}

.battle-info {
    width: 35%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#battle-log {
    width: 100%;
    height: 300px;
    overflow-y: auto;
    padding: 15px;
    margin-bottom: 20px;
    background-color: rgba(0, 0, 0, 0.7);
    border-radius: 5px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    font-family: 'Courier New', monospace;
}

.battle-message {
    margin: 8px 0;
    padding: 8px;
    border-radius: 4px;
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

.attacker-message {
    background-color: rgba(0, 100, 0, 0.5);
    border-left: 3px solid #0f0;
}

.defender-message {
    background-color: rgba(139, 0, 0, 0.5);
    border-left: 3px solid #f00;
}

.neutral-message {
    background-color: rgba(65, 65, 65, 0.5);
    border-left: 3px solid #aaa;
}

#next-round,
#end-battle {
    width: 200px;
    padding: 12px;
    margin: 10px;
    font-size: 1.1rem;
    background-color: rgba(139, 0, 0, 0.8);
    border: 1px solid #fff;
}

#next-round:hover,
#end-battle:hover {
    background-color: rgba(200, 0, 0, 0.9);
    transform: scale(1.05);
}

.army h3 {
    color: #fff;
    font-size: 1.5rem;
    margin-bottom: 15px;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.8);
}

.army p {
    margin: 10px 0;
    color: #ddd;
}

/* 針對手機設備的響應式設計 - 修改部分 */
@media (max-width: 768px) {
    #battle-view {
        min-height: 100vh; /* 使用視窗高度 */
        padding: 10px;
    }
    
    #battle-title {
        font-size: 1.5rem; /* 縮小標題字體 */
        margin-bottom: 15px;
        padding: 0 10px;
    }
    
    .battle-field {
        flex-direction: column; /* 垂直排列 */
        align-items: center;
        margin-top: 10px;
        padding: 10px;
    }
    
    .army, .battle-info {
        width: 95% !important; /* 強制寬度佔滿 */
        margin-bottom: 10px;
        padding: 15px;
    }
    
    .battle-info {
        order: 3; /* 將戰鬥信息區域移動到最下方 */
    }
    
    #battle-log {
        height: 200px; /* 縮小日誌高度 */
        padding: 10px;
        font-size: 0.9rem; /* 縮小日誌字體 */
    }
    
    #next-round, 
    #end-battle {
        width: 45%; /* 按鈕並排顯示 */
        display: inline-block;
        margin: 5px;
        padding: 8px;
        font-size: 0.9rem; /* 縮小字體 */
    }
    
    .army h3 {
        font-size: 1.2rem; /* 縮小軍隊標題 */
        margin-bottom: 10px;
    }
    
    .army p {
        font-size: 0.9rem; /* 縮小軍隊信息字體 */
        margin: 5px 0;
    }
}

/* 進一步優化小屏幕設備 */
@media (max-width: 480px) {
    #battle-title {
        font-size: 1.3rem; /* 更小的標題 */
        margin-bottom: 10px;
    }
    
    #battle-log {
        height: 150px; /* 更小的日誌高度 */
    }
    
    #next-round, 
    #end-battle {
        width: 100%; /* 超小屏幕時垂直堆疊 */
        display: block;
        margin: 5px 0;
    }
    
    .army {
        padding: 10px;
    }
    
    .battle-field {
        padding: 5px;
    }
}