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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 800px;
    margin: 0 auto;
}

header {
    text-align: center;
    color: white;
    margin-bottom: 30px;
}

header h1 {
    font-size: 28px;
    margin-bottom: 10px;
}

header p {
    opacity: 0.9;
}

.card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.card h2 {
    margin-bottom: 20px;
    color: #333;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    color: #555;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
}

.btn {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
}

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

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #f5f5f5;
    color: #666;
}

.btn-secondary:hover {
    background: #e8e8e8;
}

.btn-success {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: white;
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(17, 153, 142, 0.4);
}

.btn-group {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.btn-group .btn {
    flex: 1;
}

.hidden {
    display: none !important;
}

/* 进度条 */
.progress-bar {
    background: #e0e0e0;
    height: 8px;
    border-radius: 4px;
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
}

.progress-fill {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s;
}

.progress-text {
    position: absolute;
    right: 0;
    top: -25px;
    font-size: 14px;
    color: #666;
}

/* 题目样式 */
.question-meta {
    margin-bottom: 12px;
}

.chapter {
    display: inline-block;
    background: #e3f2fd;
    color: #1976d2;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 14px;
    margin-right: 8px;
}

.difficulty {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 14px;
}

.difficulty.简单 {
    background: #e8f5e9;
    color: #388e3c;
}

.difficulty.中等 {
    background: #fff3e0;
    color: #f57c00;
}

.difficulty.困难 {
    background: #ffebee;
    color: #d32f2f;
}

#question-content {
    font-size: 18px;
    line-height: 1.6;
    color: #333;
    margin-bottom: 20px;
}

/* 选项样式 */
.options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.option {
    display: flex;
    align-items: center;
    padding: 16px;
    background: #f9f9f9;
    border: 2px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.option:hover {
    background: #f0f0f0;
    border-color: #667eea;
}

.option.selected {
    background: #e3f2fd;
    border-color: #667eea;
}

.option-key {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: white;
    border: 2px solid #ddd;
    border-radius: 50%;
    margin-right: 12px;
    font-weight: bold;
    color: #666;
}

.option.selected .option-key {
    background: #667eea;
    border-color: #667eea;
    color: white;
}

.option-text {
    flex: 1;
    font-size: 16px;
}

/* 结果样式 */
.score-display {
    text-align: center;
    margin: 30px 0;
}

.score-number {
    font-size: 72px;
    font-weight: bold;
    color: #667eea;
}

.score-total {
    font-size: 36px;
    color: #999;
}

.score-rate {
    text-align: center;
    font-size: 20px;
    color: #666;
    margin-bottom: 30px;
}

.result-details {
    margin: 20px 0;
}

.result-item {
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 12px;
}

.result-item.correct {
    background: #e8f5e9;
    border-left: 4px solid #4caf50;
}

.result-item.wrong {
    background: #ffebee;
    border-left: 4px solid #f44336;
}

.result-header {
    display: flex;
    justify-content: space-between;
    font-weight: bold;
    margin-bottom: 8px;
}

.result-item.correct .result-status {
    color: #4caf50;
}

.result-item.wrong .result-status {
    color: #f44336;
}

.result-answer {
    color: #666;
    margin-bottom: 8px;
}

.result-explanation {
    color: #333;
    font-size: 14px;
    line-height: 1.5;
}

/* 新增：详细结果样式 */
.result-item {
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 16px;
    background: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.result-item.correct {
    background: #f0f9f0;
    border: 2px solid #4caf50;
}

.result-item.wrong {
    background: #fff5f5;
    border: 2px solid #f44336;
}

.result-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.question-order {
    background: #667eea;
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: bold;
}

.question-chapter {
    background: #e3f2fd;
    color: #1976d2;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 13px;
}

.question-difficulty {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 13px;
}

.question-difficulty.简单 {
    background: #d4edda;
    color: #155724;
}

.question-difficulty.中等 {
    background: #fff3cd;
    color: #856404;
}

.question-difficulty.困难 {
    background: #f8d7da;
    color: #721c24;
}

.result-status {
    margin-left: auto;
    font-size: 16px;
    font-weight: bold;
}

.question-content {
    font-size: 16px;
    line-height: 1.6;
    color: #333;
    margin-bottom: 12px;
    font-weight: 500;
}

.result-options {
    margin: 12px 0;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
}

.option-item {
    padding: 8px 12px;
    margin: 6px 0;
    border-radius: 6px;
    font-size: 14px;
}

.option-item.correct-option {
    background: #d4edda;
    color: #155724;
    font-weight: bold;
}

.option-item.wrong-option {
    background: #f8d7da;
    color: #721c24;
    text-decoration: line-through;
}

.result-answer {
    margin: 12px 0;
    padding: 10px;
    background: #f0f0f0;
    border-radius: 6px;
    font-size: 14px;
}

.correct-text {
    color: #4caf50;
    font-weight: bold;
}

.wrong-text {
    color: #f44336;
    font-weight: bold;
}

.result-explanation {
    margin-top: 12px;
    padding: 12px;
    background: #fff;
    border-radius: 6px;
    border-left: 3px solid #667eea;
}

.result-explanation strong {
    color: #667eea;
}

/* 页脚 */
footer {
    text-align: center;
    color: white;
    opacity: 0.8;
    margin-top: 30px;
}

footer a {
    color: white;
}

/* 下拉选择框样式 */
.form-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s;
}

.form-group select:focus {
    outline: none;
    border-color: #667eea;
}

/* 按钮组 */
.btn-group {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.btn-group .btn {
    flex: 1;
}

/* 答题历史区域 */
.history-section {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid #e0e0e0;
}

.history-section h3 {
    margin-bottom: 16px;
    color: #333;
}

.history-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: nowrap;
}

.history-title-row h2 {
    margin-bottom: 0;
}

.history-filter-inline {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: #475467;
    cursor: pointer;
    user-select: none;
    padding: 4px 0;
}

.history-filter-inline:focus-visible {
    outline: 2px solid rgba(102, 126, 234, 0.45);
    outline-offset: 4px;
    border-radius: 8px;
}

.history-filter-label {
    font-size: 16px;
    font-weight: 600;
    color: #344054;
    white-space: nowrap;
}

.history-filter-switch {
    position: relative;
    width: 38px;
    height: 22px;
    display: inline-block;
    flex-shrink: 0;
}

.history-filter-switch input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.history-filter-switch-slider {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: #d1d5db;
    transition: all 0.2s ease;
}

.history-filter-switch-slider::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    left: 3px;
    top: 3px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
    transition: transform 0.2s ease;
}

.history-filter-switch input:checked + .history-filter-switch-slider {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.history-filter-switch input:checked + .history-filter-switch-slider::before {
    transform: translateX(16px);
}

@media (max-width: 768px) {
    .history-title-row {
        flex-wrap: wrap;
        align-items: flex-start;
    }

    .history-filter-inline {
        width: 100%;
        justify-content: flex-start;
    }

    .history-filter-label {
        font-size: 15px;
    }
}

.history-summary {
    background: #f8f9fa;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    color: #666;
    font-size: 14px;
}

.history-day {
    margin-bottom: 20px;
    background: #f8f9fa;
    border-radius: 12px;
    overflow: hidden;
}

.history-day-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.history-date {
    font-weight: bold;
    font-size: 16px;
}

.history-score {
    font-size: 14px;
}

.history-questions {
    padding: 12px;
}

.history-question {
    background: white;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 8px;
}

.history-question:last-child {
    margin-bottom: 0;
}

.history-question.correct {
    border-left: 4px solid #4caf50;
}

.history-question.wrong {
    border-left: 4px solid #f44336;
}

.history-q-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.history-q-num {
    background: #667eea;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
}

.history-q-chapter {
    font-size: 12px;
    color: #666;
}

.history-q-difficulty {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
}

.history-q-difficulty.\u7b80\u5355 {
    background: #d4edda;
    color: #155724;
}

.history-q-difficulty.\u4e2d\u7b49 {
    background: #fff3cd;
    color: #856404;
}

.history-q-difficulty.\u56f0\u96be {
    background: #f8d7da;
    color: #721c24;
}

.history-q-status {
    margin-left: auto;
    font-weight: bold;
}

.history-question.correct .history-q-status {
    color: #4caf50;
}

.history-question.wrong .history-q-status {
    color: #f44336;
}

.history-q-content {
    font-size: 14px;
    color: #333;
    margin-bottom: 8px;
    line-height: 1.5;
}

.history-q-options {
    margin-bottom: 8px;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 8px;
}

.history-option-item {
    font-size: 13px;
    line-height: 1.5;
    color: #555;
    padding: 6px 8px;
    border-radius: 6px;
    margin-bottom: 4px;
}

.history-option-item:last-child {
    margin-bottom: 0;
}

.history-option-item.correct-option {
    background: #d4edda;
    color: #155724;
    font-weight: 600;
}

.history-option-item.wrong-option {
    background: #f8d7da;
    color: #721c24;
    text-decoration: line-through;
}

.history-q-answer {
    font-size: 13px;
    color: #666;
    margin-bottom: 8px;
    padding: 8px;
    background: #f0f0f0;
    border-radius: 6px;
}

.history-q-explanation {
    font-size: 13px;
    color: #555;
    line-height: 1.5;
}

.loading, .error, .no-data {
    text-align: center;
    padding: 30px;
    color: #666;
}

.error {
    color: #f44336;
}

/* 政策出处样式 */
.law-reference {
    margin-top: 8px;
    padding: 8px 12px;
    background: #f0f7ff;
    border-radius: 6px;
    font-size: 13px;
    color: #1976d2;
    border-left: 3px solid #1976d2;
}

@media (max-width: 600px) {
    body {
        padding: 12px;
        overflow-x: hidden;
    }

    .container,
    main,
    .card,
    form,
    .form-group {
        width: 100%;
        min-width: 0;
        max-width: 100%;
    }

    .card {
        padding: 20px;
    }

    .ranking-box {
        min-width: 0 !important;
        width: 100%;
    }
}
