/* --- 1. CSS 變數與全域設定 --- */
:root {
    --bg-color: #121212; /* 更深的背景色 */
    --card-bg-color: #1E1E1E; /* 卡片背景色 */
    --primary-color: #007BFF; /* 主題藍色 */
    --primary-hover-color: #0056b3; /* 主題藍色懸停 */
    --text-color: #EAEAEA; /* 主要文字顏色 */
    --text-color-secondary: #A0A0A0; /* 次要文字顏色 */
    --border-color: #333333; /* 邊框顏色 */
    --shadow-color: rgba(0, 0, 0, 0.4); /* 陰影顏色 */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; /* 字體 */
}

/* 全域 Box Sizing 設定，讓排版更直觀 */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* --- 2. 頁面整體佈局 (行動裝置優先) --- */
body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

h1, h2, h3 {
    color: var(--text-color);
    margin-bottom: 0.5em;
}

p {
    color: var(--text-color-secondary);
    margin-bottom: 1em;
}

/* --- 3. 主要容器與卡片設計 --- */
.main-container {
    width: 100%;
    max-width: 800px; /* 在大螢幕上的最大寬度 */
    display: flex;
    flex-direction: column;
    gap: 25px; /* 卡片之間的間距 */
}

.mode-card {
    background-color: var(--card-bg-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 8px 20px var(--shadow-color);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.mode-card:hover {
    transform: translateY(-5px); /* 滑鼠懸停時輕微上移 */
    box-shadow: 0 12px 30px var(--shadow-color);
}

/* --- 4. 美化上傳按鈕 (關鍵技巧) --- */
.custom-file-upload {
    display: inline-block;
    padding: 12px 20px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 8px;
    cursor: pointer;
    text-align: center;
    transition: background-color 0.3s ease;
    font-weight: 500;
}

.custom-file-upload:hover {
    background-color: var(--primary-hover-color);
}

/* 隱藏原生、醜陋的 input[type=file] 按鈕 */
input[type="file"] {
    display: none;
}

/* --- 5. 元件與細節樣式 --- */
.header, .footer {
    text-align: center;
    max-width: 800px;
    width: 100%;
    padding: 10px 0;
}

.footer {
    margin-top: auto; /* 將頁腳推到底部 */
    color: var(--text-color-secondary);
    font-size: 0.9em;
}

.button-group {
    display: flex;
    flex-direction: column; /* 手機上垂直排列 */
    gap: 15px;
}

.sub-mode {
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
    margin-top: 20px;
}

.status-content {
    text-align: center;
}

#status-text {
    font-size: 1.1em;
    margin-bottom: 15px;
}

progress {
    width: 100%;
    height: 12px;
    -webkit-appearance: none;
    appearance: none;
    border: none;
    border-radius: 10px;
    overflow: hidden;
    background-color: #333;
}

/* Chrome/Safari 的進度條樣式 */
progress::-webkit-progress-bar {
    background-color: #333;
    border-radius: 10px;
}
progress::-webkit-progress-value {
    background-color: var(--primary-color);
    border-radius: 10px;
    transition: width 0.3s ease;
}

#download-area a {
    display: block;
    margin-top: 20px;
    padding: 15px 25px;
    background-color: #28a745;
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-size: 1.2em;
    font-weight: bold;
    transition: background-color 0.3s ease;
}
#download-area a:hover {
    background-color: #218838;
}


/* --- 6. 響應式設計 (電腦版樣式) --- */
@media (min-width: 768px) {
    body {
        padding: 40px;
    }

    .button-group {
        flex-direction: row; /* 在大螢幕上水平排列 */
        justify-content: center;
    }

    .mode-card {
        padding: 35px;
    }
}