body {
    font-family: Arial, sans-serif;
    background-color: #f4f4f4;
    color: #333;
    line-height: 1.6;
    margin: 0;
    padding: 0;
	font-size:20px;
}

#app-container {
    max-width: 680px;
    margin: 50px auto; 
    padding: 20px;
    background-color: white;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    position: relative; 
    overflow: hidden; 
}

/* --- 背景反饋圖示 (不變) --- */
#app-container.feedback-bg-correct::after,
#app-container.feedback-bg-incorrect::after {
    content: '✔';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 350px; 
    font-weight: bold;
    color: rgba(40, 167, 69, 0.08); 
    z-index: 1; 
}
#app-container.feedback-bg-incorrect::after {
    content: '✘';
    color: rgba(220, 53, 69, 0.08); 
}


/* --- 畫面切換邏輯 (不變) --- */
.screen-panel {
    display: none; 
}
.active-screen {
    display: block; 
    z-index: 10; 
    position: relative; 
}
.hidden {
    display: none;
}

/* --- 主選單樣式 (不變) --- */
h1 {
    text-align: center;
    color: #005a9c;
    border-bottom: 2px solid #ccc;
    padding-bottom: 10px;
}
h2 {
    margin-top: 20px;
    color: #444;
}
.input-group {
    margin-bottom: 20px;
    text-align: center;
}
#question-count {
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    width: 60px;
    text-align: center;
    font-size: 1em;
}


#quiz-list h3 {
    margin-top: 25px;
    margin-bottom: 10px;
    text-align: left;
    color: #333;
    border-bottom: 2px solid #005a9c; 
    padding-bottom: 5px;
    font-size: 1.3em;
}
.last-attempt{
	margin:0px;
}
.quiz-item{
	margin:5px;
	border:2px solid #adddfa;
	padding:5px;
	border-radius: 5px;
}
.quiz-item h4{
	margin:0px;
}
.quiz-container {
    display: flex; /* 啟用 Flex 佈局 */
    align-items: center; /* 讓子元素在垂直方向上居中對齊 */
}
.quiz-stats {
    /* 讓統計區塊佔用剩餘的空間 (100% - 按鈕寬度) */
    flex-grow: 1; 
    /* 確保其不會因內容過長而超出容器 */
    min-width: 0; 
}
.start-quiz-btn{
	width:20%;
	min-width:100px;
	background-color: #007bff;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.3s;
}
.start-quiz-btn:hover {
    background-color: #0056b3;
}
.quiz-item h4 .total-count {
    font-size: 0.9em;
    color: #999;
    font-weight: normal; /* 讓總題數部分不要粗體 */
    margin-left: 5px;
}

/* --- 測驗畫面通用樣式 --- */
#quiz-title {
    text-align: center;
    color: #005a9c;
    margin-bottom: 15px;
}
#quiz-progress {
    text-align: center;
    margin-bottom: 20px;
    font-weight: bold;
    color: #666;
}
#question-container {
    background-color: #e9ecef;
    padding: 20px;
    border-radius: 8px;
}
#question-text {
    margin: 0; 
    font-size: 1.2em;
    font-weight: 500;
}

/* --- 圖片庫樣式 (通用) (不變) --- */
.question-image-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 15px;
    padding: 10px;
    background-color: #f8f9fa; 
    border-radius: 5px;
    border: 1px solid #dee2e6;
    justify-content: center; 
}
.question-image-container {
    border: 1px solid #ccc;
    border-radius: 5px;
    padding: 5px;
    background-color: white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.question-image-container img {
    max-width: 100%; 
    height: auto;
    display: block;
}

/* --- (START) *** 新增：解析區塊樣式 *** --- */
.explanation-box {
    margin-top: 20px;
    padding: 15px;
    background-color: #fffaf0; /* 淡黃色/米色 */
    border: 1px solid #ffeeba; /* 黃色邊框 */
    border-radius: 8px;
}
.explanation-box-title {
    font-weight: bold;
    font-size: 1.1em;
    color: #856404; /* 深黃褐色 */
    margin: 0 0 10px 0;
}
.explanation-box-content {
    font-size: 1em;
    color: #555;
    line-height: 1.6;
}
/* --- (END) *** 新增：解析區塊樣式 *** --- */


/* --- (A) 是非題 (T/F) 樣式 (不變) --- */
.tf-buttons {
    display: flex;
    justify-content: space-around;
    gap: 15px;
    margin-top: 15px; 
}
.tf-buttons button {
    flex: 1;
    padding: 15px 0;
    font-size: 1.5em;
    font-weight: bold;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s, opacity 0.3s;
}
#true-btn { background-color: #28a745; color: white; }
#false-btn { background-color: #dc3545; color: white; }
#true-btn:hover:not(:disabled),
#false-btn:hover:not(:disabled) {
    opacity: 0.8;
}

/* --- (B) 選擇題 (SELECT) 樣式 (不變) --- */
#options-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 15px; 
}
.option-button {
    width: 100%;
    padding: 15px;
    font-size: 1.1em;
    font-weight: bold;
    color: #333;
    background-color: white;
    border: 2px solid #007bff;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s, border-color 0.3s, color 0.3s;
    text-align: left; 
}
.option-button:hover:not(:disabled) { background-color: #e9ecef; }
.option-button:disabled { opacity: 0.7; cursor: not-allowed; }
.option-button.correct-answer-hint {
    background-color: #d4edda;
    border-color: #28a745;
    color: #155724;
}
.option-button.user-selected-wrong {
    background-color: #f8d7da;
    border-color: #dc3545;
    color: #721c24;
    opacity: 1;
}

/* --- (C) 綜合題 (MIX) 樣式 (不變) --- */
#mix-content-container {
    margin-top: 15px; 
    margin-bottom: 20px;
}
#confirm-answer-btn {
    display: block;
    width: 100%;
    padding: 15px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1.2em;
    transition: background-color 0.3s;
}
#confirm-answer-btn:hover:not(:disabled) { background-color: #0056b3; }

/* (MIX 子樣式... 不變) */
.check-option {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: white;
}
.check-option input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-right: 15px;
    cursor: pointer;
}
.check-option.correct-answer-hint { border-left: 5px solid #28a745; }
.check-option.user-selected-wrong { border-left: 5px solid #dc3545; }

#draggable-bank {
    background-color: #f9f9f9;
    border: 1px dashed #005a9c;
    border-radius: 8px;
    padding: 15px;
    margin-top: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    min-height: 40px;
}
.draggable-item {
    padding: 8px 15px;
    background-color: #007bff;
    color: white;
    border-radius: 20px;
    cursor: grab;
    user-select: none;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.draggable-item:active { cursor: grabbing; }
.draggable-helper {
    opacity: 1; 
    z-index: 10000;
    transform: scale(1.05); 
    box-shadow: 0 5px 15px rgba(0,0,0,0.3); 
}
.match-list { list-style: none; padding: 0; margin: 0; }
.match-stem {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    background-color: white;
    padding: 10px;
    border-radius: 5px;
}
.stem-text { flex-grow: 1; padding-right: 10px; }
.clear-drop {
    position: absolute;
    top: 50%;
    right: 5px;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    background-color: rgba(255, 255, 255, 0.3);
    color: white;
    font-size: 1.2em;
    font-weight: bold;
    line-height: 18px; 
    text-align: center;
    border-radius: 50%;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.3s;
}
.clear-drop:hover { opacity: 1; }
.drop-box {
    flex-shrink: 0;
    min-height: 40px; 
    background-color: #e0e0e0;
    border: 2px dashed #999;
    border-radius: 5px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-style: italic;
    color: #777;
    transition: background-color 0.3s, border-color 0.3s;
    position: relative; 
    padding: 5px;
    box-sizing: border-box;
    word-break: break-word; 
}
.match-drop-target { width: 200px; }
.fill-drop-target {
    display: inline-block; 
    width: 180px;
    vertical-align: middle; 
    margin: 0 5px;
}
.drop-box.drop-hover { background-color: #d4edda; border-color: #28a745; }
.drop-box.item-dropped {
    background-color: #007bff;
    color: white;
    font-style: normal;
    font-weight: bold;
    border-style: solid;
    padding-right: 25px; 
}

.sortable-list { list-style: none; padding: 0; margin: 0; }
.sortable-item {
    padding: 15px;
    margin-bottom: 10px;
    background-color: white;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 1.1em;
    cursor: grab;
    user-select: none;
}
.sortable-item:active { cursor: grabbing; }
.sortable-placeholder {
    height: 50px;
    background-color: #f0f0f0;
    border: 2px dashed #007bff;
    border-radius: 5px;
    margin-bottom: 10px;
}
.sortable-item.incorrect-order {
    border-left: 5px solid #dc3545;
    background-color: #f8d7da;
}

.fill-content {
    font-size: 1.2em;
    line-height: 1.5; 
    background-color: white;
    padding: 15px;
    border-radius: 5px;
}
.fill-drop-target.incorrect-fill {
    border-color: #dc3545;
    background-color: #c82333; 
}
.fill-drop-target.correct-fill {
    border-color: #28a745;
    background-color: #218838; 
}


/* --- 浮動元件 (不變) --- */

#next-question-btn {
    position: absolute;
    bottom: 20px; 
    right: 20px; 
    z-index: 100;
    width: auto; 
    padding: 12px 20px; 
    
    background-color: #17a2b8; 
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1.1em;
    font-weight: bold;
    transition: background-color 0.3s;
}
#next-question-btn:hover {
    background-color: #138496;
}

#feedback-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 101; 
    
    width: auto;
    min-width: 200px; 
    max-width: 80%; 
    
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    
    padding: 20px 25px; 
    font-size: 1.3em; 
    font-weight: bold;
    border-radius: 8px;
    text-align: center;
    opacity: 0; 
    transition: opacity 0.3s ease, transform 0.3s ease; 
}
.correct {
    background-color: #d4edda;
    color: #155724;
}
.incorrect {
    background-color: #f8d7da;
    color: #721c24;
}


/* --- 結果畫面樣式 (不變) --- */
#results-screen h1 {
    color: #005a9c;
}
#score-summary {
    font-size: 1.8em;
    font-weight: bold;
    text-align: center;
    margin: 30px 0;
    line-height: 1.5;
}
#home-btn {
    display: block;
    width: 100%;
    padding: 15px;
    margin-top: 30px;
    font-size: 1.2em;
    background-color: #6c757d;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
}
#home-btn:hover {
    background-color: #5a6268;
}
/* 歷程紀錄面板樣式 */
.history-panel {
    display: none; /* 預設隱藏 */
    margin-top: 10px;
    padding: 10px;
    background-color: #f8f9fa;
    border-radius: 5px;
    font-size: 0.85em;
}
.history-list {
    list-style: none;
    padding: 0;
    margin: 5px 0 0 0;
}
.history-item {
    display: flex;
    justify-content: space-between;
    padding: 3px 0;
    border-bottom: 1px dashed #ddd;
}
.toggle-history-btn {
    background: none;
    border: none;
    color: #007bff;
    cursor: pointer;
    text-decoration: underline;
    font-size: 0.9em;
    padding: 0;
    margin-top: 5px;
}
.total-rate-badge {
    background-color: #17a2b8;
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: bold;
}
/* 圖表容器樣式 */
.history-panel {
    display: none;
    margin-top: 15px;
    padding: 10px;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
}

/* 限制 Canvas 高度，讓介面保持固定大小 */
.history-chart-container {
    width: 100%;
    height: 180px; /* 固定高度 */
    position: relative;
}

.toggle-history-btn {
    background: none;
    border: none;
    color: #007bff;
    cursor: pointer;
    text-decoration: underline;
    font-size: 0.9em;
    padding: 0;
    margin-top: 5px;
}