body {
    font-family: Arial, sans-serif;
    background-color: #f4f4f4;
    color: #333;
    line-height: 1.6;
    margin: 0;
    padding: 0;
}

#app-container {
    max-width: 600px;
    margin: 50px auto; 
    padding: 20px;
    background-color: white;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    min-height: 450px; 
    position: relative; 
}

/* --- 畫面切換與佔位邏輯 --- */
#welcome-screen, #quiz-screen, #results-screen {
    position: absolute; 
    top: 20px; 
    left: 20px;
    right: 20px;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s, visibility 0.3s;
    pointer-events: none; 
}

.active-screen {
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    z-index: 10;
}

.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 button {
    display: block;
    width: 100%;
    padding: 12px;
    margin-top: 10px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1.1em;
    transition: background-color 0.3s;
}

#quiz-list button:hover {
    background-color: #0056b3;
}

#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;
}

/* --- 測驗畫面樣式 --- */
#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;
    margin-bottom: 30px;
    min-height: 160px; 
}

#question-text {
    margin: 0; 
    font-size: 1.2em;
    font-weight: 500;
}

/* --- T/F 是非題系統專用按鈕 --- */
.answer-buttons {
    display: flex;
    justify-content: space-around;
    gap: 15px;
}

.answer-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;
}

/* --- 下一題按鈕樣式 --- */
#next-question-btn {
    display: block;
    width: 100%;
    padding: 12px;
    margin-top: 15px;
    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 {
    padding: 15px;
    margin-top: 20px;
    font-size: 1.2em;
    font-weight: bold;
    border-radius: 8px;
    text-align: center;
    opacity: 0; 
    transition: opacity 0.5s ease; 
}

.correct {
    background-color: #d4edda;
    color: #155724;
}

.incorrect {
    background-color: #f8d7da;
    color: #721c24;
}

/* --- (START) *** 圖片庫樣式 (已修改) *** --- */
.question-image-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 15px; /* (新) 圖片在文字下方，所以加上 margin-top */
    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-height，只限制 max-width *** */
    max-width: 100%; 
    height: auto;
    display: block;
}
/* --- (END) *** 圖片庫樣式 *** --- */


/* --- 結果畫面樣式 --- */
#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;
}