:root {
    --primary-color: #4F46E5;
    --primary-hover: #4338CA;
    --secondary-color: #10B981;
    --danger-color: #EF4444;
    --warning-color: #F59E0B;
    --bg-color: #F9FAFB;
    --card-bg: #FFFFFF;
    --text-primary: #111827;
    --text-secondary: #6B7280;
    --border-color: #E5E7EB;
    --success-bg: #D1FAE5;
    --error-bg: #FEE2E2;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: var(--text-primary);
}

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

/* Header */
.header {
    text-align: center;
    color: white;
    margin-bottom: 40px;
    animation: fadeInDown 0.6s ease;
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Page Selection */
.page-selection {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 40px;
    box-shadow: var(--shadow-lg);
    animation: fadeInUp 0.6s ease;
}

.page-selection h2 {
    margin-bottom: 30px;
    color: var(--text-primary);
    font-size: 1.8rem;
}

.page-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.page-btn {
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.page-btn:hover:not(.disabled) {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.page-btn.active {
    border-color: var(--primary-color);
    background: linear-gradient(135deg, #667eea15, #764ba215);
}

.page-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.page-number {
    font-weight: 600;
    font-size: 1.2rem;
    color: var(--text-primary);
}

.page-info {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Buttons */
.primary-btn, .secondary-btn, .nav-btn {
    padding: 14px 32px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

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

.primary-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
}

.secondary-btn {
    background: white;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.secondary-btn:hover {
    background: var(--primary-color);
    color: white;
}

.nav-btn {
    background: var(--bg-color);
    color: var(--text-primary);
}

.nav-btn:hover:not(:disabled) {
    background: var(--border-color);
}

.nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Quiz Container */
.quiz-container {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 40px;
    box-shadow: var(--shadow-lg);
    animation: fadeInUp 0.6s ease;
}

/* Progress Bar */
.progress-container {
    margin-bottom: 30px;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-weight: 600;
    color: var(--text-secondary);
}

.progress-bar {
    height: 8px;
    background: var(--bg-color);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    transition: width 0.3s ease;
    width: 0%;
}

.timer {
    text-align: right;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-color);
}

/* Question Display */
.question-display {
    min-height: 400px;
    margin-bottom: 30px;
}

.question-card {
    animation: fadeIn 0.3s ease;
}

.question-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border-color);
}

.question-type {
    background: var(--primary-color);
    color: white;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
}

.question-points {
    color: var(--text-secondary);
    font-weight: 600;
}

.question-text {
    font-size: 1.2rem;
    line-height: 1.8;
    margin-bottom: 30px;
    color: var(--text-primary);
}

.question-text code {
    background: var(--bg-color);
    padding: 2px 8px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
}

.options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.option {
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 16px 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 12px;
}

.option:hover {
    border-color: var(--primary-color);
    background: var(--bg-color);
}

.option.selected {
    border-color: var(--primary-color);
    background: linear-gradient(135deg, #667eea15, #764ba215);
}

.option.correct {
    border-color: var(--secondary-color);
    background: var(--success-bg);
}

.option.wrong {
    border-color: var(--danger-color);
    background: var(--error-bg);
}

.option-label {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    flex-shrink: 0;
}

.option.selected .option-label {
    background: var(--primary-color);
    color: white;
}

.option-text {
    flex: 1;
}

.fill-blank-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.fill-blank-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Navigation */
.navigation {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 30px;
}

/* Question Navigator */
.question-navigator {
    border-top: 2px solid var(--border-color);
    padding-top: 30px;
}

.question-navigator h3 {
    margin-bottom: 20px;
    color: var(--text-primary);
}

.question-nav-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
    gap: 10px;
}

.question-nav-btn {
    width: 50px;
    height: 50px;
    border: 2px solid var(--border-color);
    background: white;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.question-nav-btn:hover {
    border-color: var(--primary-color);
}

.question-nav-btn.answered {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.question-nav-btn.current {
    border-color: var(--primary-color);
    border-width: 3px;
}

/* Results Container */
.results-container {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 40px;
    box-shadow: var(--shadow-lg);
    animation: fadeInUp 0.6s ease;
}

.results-header {
    text-align: center;
    margin-bottom: 40px;
}

.results-header h2 {
    font-size: 2rem;
    margin-bottom: 30px;
}

.score-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 40px;
    margin-bottom: 40px;
}

.score-circle {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
}

.score-number {
    font-size: 4rem;
    font-weight: 700;
}

.score-label {
    font-size: 1.2rem;
}

.score-details {
    text-align: left;
}

.score-grade {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.score-message {
    font-size: 1.1rem;
    color: var(--text-secondary);
}

.results-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    background: var(--bg-color);
    padding: 24px;
    border-radius: 12px;
    text-align: center;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 8px;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 1rem;
}

.detailed-results {
    margin-bottom: 30px;
}

.detailed-results h3 {
    font-size: 1.5rem;
    margin-bottom: 20px;
}

.answer-card {
    background: var(--bg-color);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
    border-left: 4px solid var(--border-color);
}

.answer-card.correct {
    border-left-color: var(--secondary-color);
}

.answer-card.wrong {
    border-left-color: var(--danger-color);
}

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

.answer-status {
    padding: 6px 16px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9rem;
}

.answer-status.correct {
    background: var(--success-bg);
    color: var(--secondary-color);
}

.answer-status.wrong {
    background: var(--error-bg);
    color: var(--danger-color);
}

.answer-question {
    font-weight: 600;
    margin-bottom: 12px;
}

.answer-detail {
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.answer-explanation {
    background: white;
    padding: 16px;
    border-radius: 8px;
    margin-top: 12px;
    border-left: 3px solid var(--primary-color);
}

.results-actions {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Animations */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .header h1 {
        font-size: 1.8rem;
    }
    
    .page-selection, .quiz-container, .results-container {
        padding: 20px;
    }
    
    .score-display {
        flex-direction: column;
        gap: 20px;
    }
    
    .score-circle {
        width: 150px;
        height: 150px;
    }
    
    .score-number {
        font-size: 3rem;
    }
    
    .navigation {
        flex-direction: column;
    }
    
    .results-actions {
        flex-direction: column;
    }
    
    .results-actions button {
        width: 100%;
    }
}
