/* 全局样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #E3F2FD 0%, #BBDEFB 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    overflow-x: hidden;
}

.container {
    width: 100%;
    max-width: 600px;
    background: white;
    border-radius: 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    padding: 30px;
    position: relative;
}

/* 标题区 */
.header {
    text-align: center;
    margin-bottom: 30px;
}

.title {
    font-size: 36px;
    color: #4A90E2;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
    font-weight: bold;
}

/* 难度选择区 */
.difficulty-selector {
    display: flex;
    justify-content: space-around;
    gap: 10px;
    margin-bottom: 20px;
}

.difficulty-btn {
    flex: 1;
    height: 55px;
    background: linear-gradient(135deg, #f9f9f9 0%, #e5e5e5 100%);
    border: 2px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px;
}

.difficulty-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.difficulty-btn.active {
    background: linear-gradient(135deg, #FF6B6B 0%, #FF5252 100%);
    border-color: #FFD700;
    transform: scale(1.05);
}

.difficulty-btn.active .difficulty-text,
.difficulty-btn.active .difficulty-desc {
    color: white;
}

.difficulty-text {
    font-size: 16px;
    font-weight: bold;
    color: #666;
    margin-bottom: 2px;
}

.difficulty-desc {
    font-size: 11px;
    color: #999;
}

/* 模式选择区 */
.mode-selector {
    display: flex;
    justify-content: space-around;
    gap: 10px;
    margin-bottom: 20px;
}

.mode-btn {
    flex: 1;
    min-width: 100px;
    height: 60px;
    background: linear-gradient(135deg, #f5f5f5 0%, #e0e0e0 100%);
    border: 3px solid transparent;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: bold;
    color: #666;
}

.mode-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.mode-btn.active {
    background: linear-gradient(135deg, #4A90E2 0%, #357ABD 100%);
    border-color: #FFD700;
    color: white;
    transform: scale(1.05);
}

.mode-icon {
    font-size: 24px;
    margin-bottom: 5px;
}

.mode-text {
    font-size: 14px;
}

/* 进度显示区 */
.progress-area {
    margin-bottom: 20px;
    text-align: center;
}

.progress-bar {
    width: 100%;
    height: 20px;
    background: #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4A90E2 0%, #5CB85C 100%);
    width: 0%;
    transition: width 0.5s ease;
}

.progress-text {
    font-size: 14px;
    font-weight: bold;
    color: #666;
}

/* 题目显示区 */
.question-area {
    background: linear-gradient(135deg, #FFF9C4 0%, #FFF59D 100%);
    border-radius: 20px;
    padding: 40px 20px;
    margin-bottom: 30px;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.question-display {
    text-align: center;
    width: 100%;
    line-height: 1.4;
}

.question-text {
    font-size: 48px;
    font-weight: bold;
    color: #333;
    letter-spacing: 3px;
    word-wrap: break-word;
}

/* 运算符样式 - 与数字同等大小 */
.operator-add,
.operator-subtract,
.operator-equals {
    font-size: 48px;
    font-weight: bold;
    margin: 0 8px;
    display: inline-block;
    vertical-align: middle;
}

.operator-add {
    color: #5CB85C;
}

.operator-subtract {
    color: #FF6B6B;
}

.operator-equals {
    color: #4A90E2;
}

/* 数字样式 */
.number {
    font-size: 48px;
    font-weight: bold;
    color: #333;
    display: inline-block;
    vertical-align: middle;
}

/* 答案输入区 */
.answer-area {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 30px;
}

.answer-input {
    width: 100%;
    height: 70px;
    font-size: 36px;
    text-align: center;
    border: 4px solid #4A90E2;
    border-radius: 15px;
    padding: 10px;
    outline: none;
    transition: all 0.3s ease;
}

.answer-input:focus {
    border-color: #FFD700;
    box-shadow: 0 0 20px rgba(74, 144, 226, 0.3);
}

.answer-input:disabled {
    background-color: #f5f5f5;
    border-color: #ccc;
}

.submit-btn,
.start-btn {
    width: 100%;
    height: 70px;
    font-size: 24px;
    font-weight: bold;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: white;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
}

.submit-btn {
    background: linear-gradient(135deg, #5CB85C 0%, #4CAF50 100%);
    display: none;
}

.submit-btn:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(92, 184, 92, 0.4);
}

.submit-btn:active:not(:disabled) {
    transform: translateY(0);
}

.submit-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.start-btn {
    background: linear-gradient(135deg, #FFD700 0%, #FFC107 100%);
    color: #333;
}

.start-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(255, 215, 0, 0.4);
}

.start-btn:active {
    transform: translateY(0);
}

/* 统计信息区 */
.statistics-area {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.stat-item {
    background: linear-gradient(135deg, #f5f5f5 0%, #e8e8e8 100%);
    padding: 15px;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.stat-label {
    font-size: 14px;
    color: #666;
    display: block;
    margin-bottom: 5px;
}

.stat-value {
    font-size: 28px;
    font-weight: bold;
    color: #4A90E2;
}

.stat-value.correct {
    color: #5CB85C;
}

.stat-value.streak {
    color: #FF6B6B;
}

/* 反馈消息区 */
.feedback-area {
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.feedback-message {
    font-size: 24px;
    font-weight: bold;
    text-align: center;
    padding: 10px;
    border-radius: 10px;
}

.feedback-message.correct {
    color: #5CB85C;
}

.feedback-message.incorrect {
    color: #FF6B6B;
}

/* 烟花画布 */
.fireworks-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    display: none;
}

.fireworks-canvas.active {
    display: block;
}

/* 成绩统计弹窗 */
.result-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.result-modal.show {
    display: flex;
}

.result-content {
    background: white;
    border-radius: 20px;
    padding: 40px 30px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    text-align: center;
}

.result-title {
    font-size: 28px;
    color: #4A90E2;
    margin-bottom: 30px;
    font-weight: bold;
}

.result-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.result-item {
    background: linear-gradient(135deg, #f5f5f5 0%, #e8e8e8 100%);
    padding: 20px;
    border-radius: 12px;
}

.result-label {
    font-size: 14px;
    color: #666;
    margin-bottom: 8px;
}

.result-value {
    font-size: 32px;
    font-weight: bold;
    color: #4A90E2;
}

.result-value.correct {
    color: #5CB85C;
}

.result-value.incorrect {
    color: #FF6B6B;
}

.result-message {
    font-size: 20px;
    font-weight: bold;
    color: #FF6B6B;
    margin-bottom: 30px;
    min-height: 30px;
}

.result-btn {
    width: 100%;
    height: 60px;
    background: linear-gradient(135deg, #4A90E2 0%, #357ABD 100%);
    color: white;
    font-size: 22px;
    font-weight: bold;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.result-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(74, 144, 226, 0.4);
}

.result-btn:active {
    transform: translateY(0);
}

/* 响应式设计 */
@media (max-width: 600px) {
    .container {
        padding: 20px;
        border-radius: 20px;
    }

    .title {
        font-size: 28px;
    }

    .mode-btn {
        min-width: 80px;
        height: 50px;
    }

    .mode-icon {
        font-size: 20px;
    }

    .mode-text {
        font-size: 12px;
    }

    .question-text,
    .operator-add,
    .operator-subtract,
    .operator-equals,
    .number {
        font-size: 36px;
    }

    .answer-input {
        height: 60px;
        font-size: 28px;
    }

    .submit-btn,
    .start-btn {
        height: 60px;
        font-size: 20px;
    }

    .stat-value {
        font-size: 24px;
    }

    .feedback-message {
        font-size: 20px;
    }
}

@media (max-width: 400px) {
    .statistics-area {
        grid-template-columns: 1fr;
    }

    .question-text,
    .operator-add,
    .operator-subtract,
    .operator-equals,
    .number {
        font-size: 32px;
    }
}

/* 错题回顾样式 */
.wrong-questions-container {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px dashed #E0E0E0;
}

.wrong-questions-title {
    font-size: 18px;
    color: #666;
    margin-bottom: 15px;
    text-align: center;
}

.wrong-questions-list {
    max-height: 300px;
    overflow-y: auto;
}

.wrong-question-item {
    display: flex;
    gap: 10px;
    padding: 12px;
    margin-bottom: 10px;
    background: #FFF3E0;
    border-radius: 10px;
    border-left: 4px solid #FF9800;
}

.wrong-question-number {
    font-weight: bold;
    color: #FF9800;
    flex-shrink: 0;
}

.wrong-question-content {
    flex: 1;
}

.wrong-question-expression {
    font-size: 16px;
    font-weight: bold;
    color: #333;
    margin-bottom: 5px;
}

.wrong-question-answers {
    display: flex;
    gap: 15px;
    font-size: 14px;
}

.user-answer {
    color: #F44336;
}

.user-answer strong {
    font-size: 16px;
}

.correct-answer {
    color: #4CAF50;
}

.correct-answer strong {
    font-size: 16px;
}

/* 本轮成就样式 */
.round-achievements-container {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px dashed #E0E0E0;
}

.round-achievements-title {
    font-size: 18px;
    color: #666;
    margin-bottom: 15px;
    text-align: center;
}

.round-achievements-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.round-achievement-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: linear-gradient(135deg, #FFF9C4 0%, #FFF59D 100%);
    border-radius: 10px;
    border: 2px solid #FFD700;
}

.round-achievement-item .achievement-icon {
    font-size: 32px;
}

.round-achievement-item .achievement-info {
    flex: 1;
}

.round-achievement-item .achievement-name {
    font-size: 16px;
    font-weight: bold;
    color: #F57C00;
    margin-bottom: 2px;
}

.round-achievement-item .achievement-desc {
    font-size: 12px;
    color: #666;
}

/* 成就通知（实时弹出） */
.achievement-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(255, 165, 0, 0.5);
    padding: 15px 20px;
    min-width: 300px;
    max-width: 400px;
}

.achievement-notification-content {
    display: flex;
    align-items: center;
    gap: 15px;
}

.achievement-icon-large {
    font-size: 48px;
    flex-shrink: 0;
}

.achievement-text {
    flex: 1;
}

.achievement-title {
    font-size: 14px;
    color: #fff;
    margin-bottom: 5px;
    opacity: 0.9;
}

.achievement-name-large {
    font-size: 18px;
    font-weight: bold;
    color: #fff;
    margin-bottom: 3px;
}

.achievement-desc-small {
    font-size: 12px;
    color: #fff;
    opacity: 0.8;
}

/* 时间统计样式 */
.result-time-info {
    text-align: center;
    font-size: 14px;
    color: #666;
    margin-top: 10px;
    padding: 8px;
    background: #F5F5F5;
    border-radius: 8px;
}
