/* ==================== 全局变量与基础样式 ==================== */
:root {
    --primary-color: #4CAF50;
    --primary-hover: #45a049;
    --danger-color: #f44336;
    --text-color: #333;
    --light-text: #666;
    --bg-light: #f8f9fa;
    --shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
    --radius: 12px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--bg-light);
    color: var(--text-color);
}

/* ==================== 顶部导航 ==================== */
.header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
    color: white;
    padding: 16px 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 100;
}

.back-link {
    color: white;
    text-decoration: none;
    font-size: 16px;
    font-weight: 500;
    transition: opacity 0.3s;
}
.back-link:hover { opacity: 0.8; }

.header-title { font-weight: 600; }

/* ==================== 按钮基础样式 ==================== */
.btn {
    padding: 12px 30px;
    font-size: 16px;
    border-radius: 25px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    border: none;
    display: inline-block;
}

.btn-green {
    background: var(--primary-color);
    color: white;
}
.btn-green:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.btn-light {
    background: #f5f5f5; 
    color: var(--light-text);
}
.btn-light:hover { background: #e0e0e0; }

.btn-danger {
    background: var(--danger-color);
    color: white;
}

/* ==================== 首页 ==================== */
body.home {
    background-image: url('imgs/win.jpg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    height: 100vh;
}
@media (max-width: 768px) { body.home { background-image: url('imgs/sho.jpg'); } }

.overlay-center {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    height: 100vh; text-align: center; color: white;
    background: rgba(0, 0, 0, 0.3);
}
.home-title { font-size: 48px; font-weight: bold; margin-bottom: 20px; text-shadow: 2px 2px 8px rgba(0,0,0,0.7); }
.title-line { width: 100px; height: 3px; background: white; margin-bottom: 30px; }
.start-btn {
    font-size: 32px; 
}
/* ==================== 单元目录 ==================== */
.units-wrapper { max-width: 1200px; margin: auto; padding: 40px 20px; }
.units-intro { text-align: center; margin-bottom: 40px; }
.units-intro h1 { font-size: 32px; margin-bottom: 10px; }
.units-intro p { font-size: 16px; color: var(--light-text); }

.grid-container { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }
.grid-item {
    background: white; border-radius: var(--radius);
    padding: 25px 20px; text-align: center; text-decoration: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: all 0.3s ease; border: 2px solid transparent;
}
.grid-item:hover { transform: translateY(-5px); box-shadow: 0 8px 20px rgba(76,175,80,0.2); border-color: var(--primary-color); }

.unit-number { font-size: 14px; color: var(--primary-color); font-weight: 600; }
.unit-title { font-size: 18px; font-weight: 600; margin-bottom: 8px; }
.unit-info { font-size: 13px; color: #999; }
.error-message { color: var(--danger-color); text-align: center; }

/* ==================== 答题页面 ==================== */
.quiz-center { max-width: 800px; margin: auto; padding: 30px 20px; }

.progress-bar {
    width: 100%; height: 6px; background: #e0e0e0;
    border-radius: 3px; overflow: hidden; margin-bottom: 25px;
}
.progress-fill {
    height: 100%; background: linear-gradient(90deg, var(--primary-color), #66BB6A);
    transition: width 0.4s ease;
}

.question-container {
    background: white; border-radius: var(--radius);
    padding: 30px; box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}
.question-title { font-size: 22px; font-weight: 600; margin-bottom: 25px; }

.options-container { margin-bottom: 30px; }
.option-label { display: block; margin-bottom: 12px; cursor: pointer; }
.option-label input[type="radio"] { display: none; }
.option-box {
    display: flex; align-items: center;
    padding: 16px 20px; background: var(--bg-light);
    border: 2px solid #e0e0e0; border-radius: 10px;
    transition: all 0.3s;
}
.option-label:hover .option-box { background: #f0f7f0; border-color: var(--primary-color); }
.option-label.selected .option-box { background: #e8f5e9; border-color: var(--primary-color); }

.option-letter {
    width: 32px; height: 32px; border-radius: 50%;
    border: 2px solid #ddd; display: inline-flex; align-items: center; justify-content: center;
    font-weight: bold; color: var(--light-text); margin-right: 15px;
}
.option-label.selected .option-letter { background: var(--primary-color); border-color: var(--primary-color); color: white; }

.option-text { flex: 1; }

/* ==================== 结果页 ==================== */
.result-page {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

/* 顶部分数展示 */
.result-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px;
    padding: 40px 30px;
    text-align: center;
    color: white;
    box-shadow: 0 10px 40px rgba(102, 126, 234, 0.3);
    margin-bottom: 30px;
}

.result-header h2 {
    font-size: 32px;
    margin-bottom: 25px;
}

.score-display {
    margin-top: 20px;
}

.score-circle {
    width: 180px;
    height: 180px;
    margin: 0 auto 20px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    border: 4px solid rgba(255, 255, 255, 0.3);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.score-number {
    font-size: 64px;
    font-weight: bold;
    line-height: 1;
}

.score-total {
    font-size: 24px;
    opacity: 0.9;
}

.score-percentage {
    font-size: 28px;
    font-weight: 600;
    margin-top: 10px;
}

/* 答题详情区域 */
.answers-section {
    margin-bottom: 30px;
}

.section-title {
    font-size: 24px;
    color: var(--text-color);
    margin-bottom: 25px;
    text-align: center;
}

/* 题目卡片 */
.question-card {
    background: white;
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.q-number {
    font-size: 16px;
    font-weight: 600;
    color: var(--light-text);
}

.result-badge {
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 15px;
    font-weight: 600;
}

.badge-correct {
    background: #4CAF50;
    color: white;
}

.badge-wrong {
    background: #f44336;
    color: white;
}

.q-text {
    font-size: 18px;
    font-weight: 500;
    color: var(--text-color);
    margin-bottom: 20px;
    line-height: 1.6;
}

/* 答案选项 - 核心：整行背景色 */
.answer-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.answer-option {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    border-radius: 10px;
    font-size: 16px;
    background: #f5f5f5;
    border: 2px solid transparent;
}

/* 正确答案：整行亮绿色 */
.answer-option.correct-answer {
    background: #4CAF50 !important;
    color: white !important;
    font-weight: 600;
    border-color: #388E3C;
}

.answer-option.correct-answer .ans-letter {
    background: rgba(255, 255, 255, 0.3);
    color: white;
    border: 2px solid white;
}

.answer-option.correct-answer .ans-text {
    color: white;
}

.answer-option.correct-answer .answer-icon {
    color: white;
}

/* 用户选错的答案：整行亮红色 */
.answer-option.wrong-answer {
    background: #f44336 !important;
    color: white !important;
    font-weight: 600;
    border-color: #d32f2f;
}

.answer-option.wrong-answer .ans-letter {
    background: rgba(255, 255, 255, 0.3);
    color: white;
    border: 2px solid white;
}

.answer-option.wrong-answer .ans-text {
    color: white;
}

.answer-option.wrong-answer .answer-icon {
    color: white;
}

.ans-letter {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #ddd;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 16px;
    margin-right: 15px;
    flex-shrink: 0;
}

.ans-text {
    flex: 1;
}

.answer-icon {
    font-size: 22px;
    font-weight: bold;
    margin-left: 10px;
}

/* 操作按钮 */
.action-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 30px;
}

.btn-action {
    padding: 16px 40px;
    font-size: 17px;
    font-weight: 600;
    border-radius: 30px;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: white;
    color: #667eea;
    border: 2px solid #667eea;
}

.btn-secondary:hover {
    background: #667eea;
    color: white;
    transform: translateY(-3px);
}

/* 响应式 */
@media (max-width: 768px) {
    .result-header {
        padding: 30px 20px;
    }
    
    .result-header h2 {
        font-size: 26px;
    }
    
    .score-circle {
        width: 150px;
        height: 150px;
    }
    
    .score-number {
        font-size: 52px;
    }
    
    .score-percentage {
        font-size: 22px;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .btn-action {
        width: 100%;
    }
}
/* ==================== 响应式 ==================== */
@media (max-width: 768px) {
    .home-title { font-size: 36px; }
    .score-big { font-size: 52px; }
    .score-small { font-size: 24px; }
    .result-actions { flex-direction: column; }
    .result-btn { width: 100%; }
}
