/* style.css (完整版) */

/* === 基本樣式 === */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f0f2f5;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    color: #333;
    padding: 20px;
    box-sizing: border-box;
}

#app {
    width: 100%;
    max-width: 700px;
}

/* === 卡片通用樣式 === */
.card {
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    padding: 30px;
    width: 100%;
    box-sizing: border-box;
    text-align: center;
}

/* === 首頁 / 科目選擇頁 === */
.selection-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.header-card h1 {
    font-size: 1.8em;
    color: #1d3557;
    margin: 0 0 10px 0;
}

.header-card p {
    margin: 5px 0 0;
    color: #666;
}

.selection-card h2 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #444;
}

.subject-select {
    width: 100%;
    padding: 12px;
    font-size: 1em;
    border-radius: 5px;
    border: 1px solid #ccc;
    margin-bottom: 20px;
}

.start-button {
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 5px;
    padding: 12px 25px;
    font-size: 1.1em;
    cursor: pointer;
    width: 100%;
    transition: background-color 0.2s;
}

.start-button:hover {
    background-color: #0056b3;
}

.page-footer {
    font-size: 0.8em;
    color: #999;
    text-align: center;
    margin-top: 10px;
}

/* === 測驗頁 === */
.quiz-container {
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    padding: 30px;
    box-sizing: border-box;
}

.quiz-header h2 {
    text-align: center;
    color: #1d3557;
    margin-top: 0;
}

.question-area h3 {
    font-size: 1.2em;
    line-height: 1.6;
    margin-bottom: 25px;
}

/* --- 測驗選項樣式 (已升級) --- */
.option-list {
    list-style-type: none;
    padding: 0;
    margin: 0;
}

.option {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 15px 15px 15px 45px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    position: relative;
}

.option:hover {
    background-color: #e9ecef;
    border-color: #adb5bd;
}

.option.selected {
    border-color: #007bff;
    background-color: #e7f3ff;
}

.option.correct {
    border-color: #28a745;
    background-color: #d4edda;
    color: #155724;
    font-weight: bold;
}

.option.correct::before {
    content: '✓';
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.5em;
    color: #28a745;
}

.option.incorrect {
    border-color: #dc3545;
    background-color: #f8d7da;
    color: #721c24;
}

.option.incorrect::before {
    content: '✗';
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.2em;
    color: #dc3545;
}

/* --- 解說與導覽 --- */
.explanation-area {
    margin-top: 25px;
    padding: 20px;
    background-color: #fffbe6;
    border: 1px solid #ffeeba;
    border-radius: 8px;
    line-height: 1.7;
}
.explanation-area h4 { margin-top: 0; }

.navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 30px;
    border-top: 1px solid #eee;
    padding-top: 20px;
}

.progress {
    color: #666;
    font-weight: bold;
}

.nav-button {
    background-color: #4a90e2;
    color: white;
    border: none;
    border-radius: 5px;
    padding: 10px 20px;
    font-size: 1em;
    cursor: pointer;
    transition: background-color 0.2s;
}

.nav-button:hover {
    background-color: #357abd;
}


/* === 結果頁 === */
.results-container {
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    padding: 30px;
    box-sizing: border-box;
}

.results-container h2, .results-container p {
    text-align: center;
}

#score-text {
    font-size: 1.5em;
    font-weight: bold;
    color: #1d3557;
}

.results-summary {
    display: flex;
    justify-content: space-between;
    margin: 30px 0;
    gap: 20px;
}

.results-summary > div {
    flex: 1;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
    gap: 8px;
    margin-top: 10px;
}

.result-item {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 40px;
    height: 40px;
    border-radius: 5px;
    color: white;
    font-weight: bold;
}

.result-item.correct {
    background-color: #28a745;
}

.result-item.incorrect {
    background-color: #dc3545;
}


/* === 新增：題數輸入框樣式 === */
.num-input-wrapper {
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.num-input {
    width: 80px;
    padding: 10px;
    font-size: 1em;
    text-align: center;
    border: 1px solid #ccc;
    border-radius: 5px;
}

/* === 新增：結果頁按鈕容器樣式 === */
.results-actions {
    margin-top: 30px;
    border-top: 1px solid #eee;
    padding-top: 20px;
    display: flex;
    justify-content: center;
    gap: 15px; /* 按鈕之間的間距 */
}

/* === 新增：次要按鈕樣式 (用於「回主選單」) === */
.nav-button.secondary {
    background-color: #6c757d; /* 灰色背景 */
    color: white;
}

.nav-button.secondary:hover {
    background-color: #5a6268;
}