body {
    font-family: Arial, sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 20px;
    background-color: #f4f4f4;
}
.container {
    max-width: 800px;
    margin: 20px auto;
    padding: 20px;
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

/* Settings Container */
.settings-container {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    background-color: #f9f9f9;
    padding: 8px 12px;
    border-radius: 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.settings-label {
    margin-left: 8px;
    font-size: 14px;
    color: #555;
}

/* The switch - the box around the slider */
.switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 24px;
}

/* Hide default HTML checkbox */
.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

/* The slider */
.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    -webkit-transition: .4s;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    -webkit-transition: .4s;
    transition: .4s;
}

input:checked + .slider {
    background-color: #4CAF50;
}

input:focus + .slider {
    box-shadow: 0 0 1px #4CAF50;
}

input:checked + .slider:before {
    -webkit-transform: translateX(16px);
    -ms-transform: translateX(16px);
    transform: translateX(16px);
}

/* Rounded sliders */
.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}


h1, h2 {
    color: #333;
    text-align: center;
}
.question {
    margin-bottom: 20px;
}
.options {
    list-style-type: none;
    padding: 0;
}
.options li {
    margin-bottom: 10px;
}
.options label {
    display: block;
    padding: 10px;
    background-color: #f0f0f0;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}
.options label:hover {
    background-color: #e0e0e0;
}
.options label.correct {
    background-color: #d4edda;
    border-color: #28a745;
    color: #155724;
}
.options label.incorrect {
    background-color: #f8d7da;
    border-color: #dc3545;
    color: #721c24;
}
.options input[type="radio"] {
    margin-right: 10px;
}
.correct {
    background-color: #d4edda;
    color: #155724;
}
.incorrect {
    background-color: #f8d7da;
    color: #721c24;
}
.hidden {
    display: none;
}
button {
    display: block;
    width: 60%;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
    padding: 12px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    margin-top: 10px;
}
button:hover {
    background-color: #0056b3;
}
#result {
    text-align: center;
    font-weight: bold;
    margin-top: 20px;
}
.meta-info {
    font-size: 0.9em;
    color: #666;
    margin-bottom: 10px;
}
.difficulty {
    display: inline-block;
    padding: 3px 6px;
    border-radius: 3px;
    font-weight: bold;
}
.easy { background-color: #d4edda; color: #155724; }
.medium { background-color: #fff3cd; color: #856404; }
.hard { background-color: #f8d7da; color: #721c24; }
#csv-input {
    margin-bottom: 20px;
}
#start-quiz {
    width: 100%;
    margin-bottom: 20px;
}
#progress-bar {
    width: 100%;
    background-color: #e0e0e0;
    padding: 3px;
    border-radius: 3px;
    box-sizing: border-box;
    margin-bottom: 10px;
}
#progress-bar-inner {
    height: 20px;
    background-color: #4CAF50;
    width: 0%;
    border-radius: 2px;
    transition: width 0.3s ease-in-out;
}

#chapter-select {
    width: 100%;
    padding: 10px;
    margin-bottom: 20px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
}

#start-quiz {
    width: 100%;
    margin-bottom: 20px;
}

#restart-quiz {
    display: inline-block;
    padding: 10px 20px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    margin-top: 20px;
}

#restart-quiz:hover {
    background-color: #45a049;
}

#result p {
    font-size: 18px;
    margin-bottom: 20px;
}
/* Timer bar — fixed top strip during quiz */
.timer-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid #e8e8e8;
    z-index: 1000;
    font-size: 0.85em;
    font-weight: 600;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.timer-bar.hidden {
    display: none;
}

.timer-bar .question-timer {
    position: static;
    background: none;
    color: #dc3545;
    padding: 0;
    border-radius: 0;
    font-size: inherit;
    font-weight: inherit;
    box-shadow: none;
}

.timer-bar .question-timer.warning {
    animation: pulse 1s infinite;
}

.timer-bar .timer {
    position: static;
    background: none;
    color: #007bff;
    padding: 0;
    border-radius: 0;
    font-size: inherit;
    font-weight: inherit;
    box-shadow: none;
}

.quit-btn {
    background: none !important;
    border: 1px solid #ddd !important;
    color: #999 !important;
    padding: 4px 12px !important;
    font-size: 0.8em !important;
    border-radius: 4px !important;
    cursor: pointer;
    width: auto !important;
    display: inline-block !important;
    margin: 0 !important;
}

.quit-btn:hover {
    color: #dc3545 !important;
    border-color: #dc3545 !important;
    background: rgba(220, 53, 69, 0.05) !important;
}

/* Legacy timer styles (for standalone use) */
.timer {
    position: fixed;
    top: 20px;
    right: 20px;
    background-color: #007bff;
    color: white;
    padding: 10px 20px;
    border-radius: 5px;
    font-size: 1.2em;
    font-weight: bold;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.timer.hidden {
    display: none;
}

/* Tooltip for Memory Curve Mode */
.tooltip {
    background-color: #eef2f7;
    border-left: 5px solid #4a90e2;
    padding: 15px;
    margin-top: 15px;
    border-radius: 5px;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.tooltip.visible {
    opacity: 1;
    transform: translateY(0);
}

.tooltip p {
    margin: 5px 0;
    color: #333;
}

.tooltip p:first-child {
    font-weight: bold;
}

/* Legacy question-timer (standalone) */
.question-timer {
    position: fixed;
    top: 20px;
    left: 20px;
    background-color: #dc3545;
    color: white;
    padding: 10px 20px;
    border-radius: 5px;
    font-size: 1.2em;
    font-weight: bold;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    z-index: 1000;
    transition: background-color 0.3s ease;
}

.question-timer.warning {
    background-color: #ffc107;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

#wrong-questions-summary {
    margin-top: 20px;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 5px;
}

#wrong-questions-list {
    margin-top: 10px;
}

.option-label {
    display: flex;
    align-items: center;
    padding: 15px;
    margin: 10px 0;
    background-color: #f8f9fa;
    border: 2px solid transparent;
    border-radius: 8px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.option-label:hover {
    background-color: #e9ecef;
    transform: translateX(5px);
}

.option-label.correct {
    background-color: #d4edda;
    border-color: #28a745;
    color: #155724;
    font-weight: bold;
    animation: correctAnswer 0.5s ease;
}

.option-label.incorrect {
    background-color: #f8d7da;
    border-color: #dc3545;
    color: #721c24;
    animation: incorrectAnswer 0.5s ease;
}

@keyframes correctAnswer {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

@keyframes incorrectAnswer {
    0% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
    100% { transform: translateX(0); }
}

.option-text {
    margin-left: 10px;
}

/* 反饋樣式 */
.feedback {
    margin: 20px 0;
    padding: 15px;
    border-radius: 8px;
    font-size: 1.1em;
    line-height: 1.5;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

.feedback:not(.hidden) {
    opacity: 1;
    transform: translateY(0);
}

/* 版本信息樣式 */
.version-info {
    text-align: center;
    color: #666;
    font-size: 0.8em;
    margin-bottom: 20px;
}

.feedback.correct {
    background-color: #d4edda;
    border: 2px solid #28a745;
    color: #155724;
}

.feedback.incorrect {
    background-color: #f8d7da;
    border: 2px solid #dc3545;
    color: #721c24;
}

.feedback-header {
    font-size: 1.2em;
    margin-bottom: 10px;
    display: inline ;
}

.feedback-content {
    margin-top: 10px;
}

/* 🎨 新增：反饋區塊樣式優化 */
.answer-section {
    background-color: rgba(255, 255, 255, 0.8);
    padding: 10px;
    border-radius: 6px;
    margin-bottom: 10px;
    border-left: 4px solid #007bff;
}

.explanation-section {
    background-color: rgba(255, 255, 255, 0.6);
    padding: 12px;
    border-radius: 6px;
    border-left: 4px solid #6c757d;
}

.explanation {
    margin-top: 8px;
    font-style: italic;
    line-height: 1.6;
    color: #444;
}

/* 答案選項動畫 */
@keyframes correctAnswer {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

@keyframes incorrectAnswer {
    0% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
    100% { transform: translateX(0); }
}

/* 添加頁腳樣式 */
footer {
    margin-top: 20px;
    text-align: center;
    font-size: 12px;
    color: #aaa;
}

.footer-link {
    display: block;
    margin-bottom: 10px;
    color: #3498db;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-link:hover {
    color: #2980b9;
}

.version-info {
    margin: 0;
}

.question-progress {
    font-size: 1.2em;
    font-weight: bold;
    color: #333;
    margin-bottom: 15px;
    padding: 10px;
    background-color: #f8f9fa;
    border-radius: 5px;
    text-align: center;
    border: 2px solid #dee2e6;
}

/* 添加一個小圖標 */
.question-progress::before {
    content: "📝";
    margin-right: 8px;
}

/* 添加錯題統計相關樣式 */
.wrong-summary-header {
    margin: 15px 0;
    padding: 10px;
    background-color: #f8f9fa;
    border-radius: 5px;
}

.show-wrong-details {
    margin-top: 10px;
    padding: 5px 15px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
}

.wrong-question-panel {
    margin: 10px 0;
    border: 1px solid #ddd;
    border-radius: 5px;
}

.wrong-question-header {
    padding: 10px;
    background-color: #f8f9fa;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.wrong-question-content {
    padding: 15px;
    border-top: 1px solid #ddd;
}

.toggle-icon {
    font-weight: bold;
    margin-left: 10px;
}

/* 為大量錯題添加滾動容器 */
.wrong-details {
    max-height: 400px;
    overflow-y: auto;
    padding-right: 10px;
}

/* 篩選界面樣式 */
.filter-container {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    border: 1px solid #e1e8ed;
}

.filter-section {
    margin-bottom: 20px;
}

.filter-section label {
    display: block;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 8px;
    font-size: 14px;
}

.filter-section select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e1e8ed;
    border-radius: 8px;
    font-size: 14px;
    background-color: white;
    color: #2c3e50;
    transition: all 0.3s ease;
    cursor: pointer;
}

.filter-section select:focus {
    outline: none;
    border-color: #4a90e2;
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.filter-section select:hover {
    border-color: #bdc3c7;
}

.filter-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-top: 25px;
}

.filter-btn {
    padding: 10px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
}

.filter-btn:not(.secondary) {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.filter-btn:not(.secondary):hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.filter-btn.secondary {
    background: rgba(149, 165, 166, 0.15);
    color: #7f8c8d;
    border: 1px solid #dce1e3;
}

.filter-btn.secondary:hover {
    background: rgba(149, 165, 166, 0.25);
}

.filter-count {
    color: #555;
    padding: 6px 0;
    font-size: 13px;
    font-weight: 500;
    text-align: center;
}

/* 響應式設計 */
@media (max-width: 768px) {
    .filter-actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-btn {
        width: 100%;
        margin-bottom: 10px;
    }
    
    .filter-count {
        text-align: center;
    }
}

