/* 保持原有桌面樣式不變 */
#faction-select {
    background-image: url('../img/map.PNG');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    min-height: 600px;
    position: relative;
    padding: 20px;
}

#faction-select h1 {
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
    margin-bottom: 30px;
}

.faction-options {
    display: flex;
    justify-content: space-around;
    margin: 30px 0;
    flex-wrap: wrap;
    gap: 20px;
    position: relative;
    z-index: 1;
}

.faction-card {
    width: 300px;
    padding: 20px;
    border-radius: 10px;
    background-color: rgba(255, 255, 255, 0.9);
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    text-align: center;
    transition: transform 0.3s;
    backdrop-filter: blur(2px);
}

.faction-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    background-color: rgba(255, 255, 255, 1);
}

.faction-card h2 {
    margin-bottom: 10px;
}

.faction-card p {
    margin: 8px 0;
    color: #555;
}

/* 山歌 - 中式風格 (紅、金、黑) */
.faction-card[data-faction="shu"] {
    border-top: 5px solid #8B0000;
    background: linear-gradient(to bottom, rgba(255,255,255,0.9), rgba(255,215,0,0.1));
}

.faction-card[data-faction="shu"] h2 {
    color: #8B0000;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

.faction-card[data-faction="shu"] .select-faction {
    background-color: #8B0000;
    color: gold;
    border: 1px solid black;
}

/* 神仙 - 西方風格 (藍、白、灰) */
.faction-card[data-faction="wei"] {
    border-top: 5px solid #1E90FF;
    background: linear-gradient(to bottom, rgba(255,255,255,0.9), rgba(220,220,220,0.1));
}

.faction-card[data-faction="wei"] h2 {
    color: #1E90FF;
    text-shadow: 1px 1px 2px rgba(255,255,255,0.5);
}

.faction-card[data-faction="wei"] .select-faction {
    background-color: #1E90FF;
    color: white;
    border: 1px solid silver;
}

/* 天渺 - 中東風格 (深黃、黃、淺黃) */
.faction-card[data-faction="wu"] {
    border-top: 5px solid #DAA520;
    background: linear-gradient(to bottom, rgba(255,255,255,0.9), rgba(255,215,0,0.1));
}

.faction-card[data-faction="wu"] h2 {
    color: #8B4513;
    text-shadow: 1px 1px 2px rgba(255,255,0,0.3);
}

.faction-card[data-faction="wu"] .select-faction {
    background-color: #DAA520;
    color: #8B4513;
    border: 1px solid #CD853F;
}

.select-faction {
    margin-top: 15px;
    width: 100%;
    padding: 8px;
    border-radius: 5px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

.select-faction:hover {
    transform: scale(1.05);
}

/* 新增手機版樣式 */
@media (max-width: 768px) {
    #faction-select {
        min-height: auto; /* 移除固定高度 */
        padding: 10px; /* 減少內邊距 */
		height: 800px;
    }
    
    .faction-options {
        flex-direction: column; /* 垂直排列 */
        align-items: center; /* 置中對齊 */
        margin: 15px 0; /* 減少外邊距 */
        gap: 15px; /* 減少間距 */
    }
    
    .faction-card {
        width: 90%; /* 使用百分比寬度 */
        max-width: 300px; /* 但仍限制最大寬度 */
        padding: 15px; /* 減少內邊距 */
    }
    
    #faction-select h1 {
        font-size: 1.5rem; /* 縮小標題字體 */
        margin-bottom: 20px; /* 減少下邊距 */
    }
}
/* 新增精細化的手機版樣式 */
@media (max-width: 768px) {
    #faction-select {
        min-height: auto;
        padding: 8px 5px; /* 更緊湊的內邊距 */
        background-attachment: fixed; /* 背景固定，避免滾動時移動 */
    }
    
    #faction-select h1 {
        font-size: 1.4rem; /* 更小的標題 */
        margin-bottom: 15px;
        padding: 0 10px; /* 添加左右內邊距 */
        text-align: center; /* 確保標題居中 */
    }
    
    .faction-options {
        flex-direction: column;
        align-items: center;
        margin: 10px 0; /* 更小的外邊距 */
        gap: 12px; /* 更緊湊的間距 */
        padding: 0 5px; /* 添加左右內邊距 */
    }
    
    .faction-card {
        width: 95%; /* 更大的寬度利用率 */
        max-width: 280px; /* 稍小的最大寬度 */
        padding: 12px 10px; /* 更緊湊的內邊距 */
        margin: 0 auto; /* 確保居中 */
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); /* 更輕的陰影 */
    }
    
    .faction-card h2 {
        font-size: 1.2rem; /* 更小的標題 */
        margin-bottom: 8px;
    }
    
    .faction-card p {
        font-size: 0.9rem; /* 更小的字體 */
        margin: 6px 0; /* 更緊湊的行距 */
        line-height: 1.4; /* 更好的可讀性 */
    }
    
    .select-faction {
        padding: 8px 12px; /* 更適合手指點擊的大小 */
        font-size: 0.9rem; /* 按鈕文字大小調整 */
    }
    
    /* 針對非常小的手機 (如iPhone 5/SE) */
    @media (max-width: 320px) {
        .faction-card {
            max-width: 260px;
            padding: 10px 8px;
        }
        
        #faction-select h1 {
            font-size: 1.3rem;
        }
        
        .faction-card h2 {
            font-size: 1.1rem;
        }
    }
    
    /* 針對中等尺寸手機 (如大多數現代手機) */
    @media (min-width: 321px) and (max-width: 480px) {
        .faction-card {
            max-width: 300px;
        }
    }
}