/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* 赛前设置页 */
.setup-page {
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    text-align: center;
    min-width: 400px;
}

.setup-page h1 {
    color: #4a90e2;
    margin-bottom: 30px;
    font-size: 2.5em;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}

.setup-page h3 {
    color: #333;
    margin-bottom: 15px;
    font-size: 1.3em;
    font-weight: bold;
}

/* 题目类型选择区域 */
.question-types {
    margin-bottom: 30px;
}

.type-checkboxes {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    margin-top: 15px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 10px 15px;
    border: 2px solid #ddd;
    border-radius: 10px;
    transition: all 0.3s ease;
    background: #f8f9fa;
}

.checkbox-item:hover {
    border-color: #4a90e2;
    background: #e3f2fd;
}

.checkbox-item input[type="checkbox"] {
    display: none;
}

.checkbox-item input[type="checkbox"]:checked + .checkmark {
    background: #4a90e2;
    border-color: #4a90e2;
}

.checkbox-item input[type="checkbox"]:checked + .checkmark::after {
    content: '✓';
    color: white;
    font-weight: bold;
    font-size: 14px;
}

.checkbox-item input[type="checkbox"]:checked ~ .type-label {
    color: #4a90e2;
    font-weight: bold;
}

.checkbox-item input[type="checkbox"]:checked ~ .checkmark {
    background: #4a90e2;
}

.checkmark {
    width: 20px;
    height: 20px;
    border: 2px solid #ddd;
    border-radius: 4px;
    margin-right: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.type-label {
    font-size: 1.1em;
    color: #333;
    transition: all 0.3s ease;
}

/* 题目数量选择 */
.question-count {
    margin-bottom: 30px;
}

.count-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 15px;
}

.count-btn {
    padding: 12px 20px;
    font-size: 1.1em;
    border: 2px solid #ddd;
    border-radius: 10px;
    background: white;
    color: #333;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 60px;
}

.count-btn:hover {
    border-color: #4a90e2;
    background: #e3f2fd;
}

.count-btn.active {
    background: #4a90e2;
    color: white;
    border-color: #4a90e2;
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.3);
}

/* 旧的设置样式（兼容） */
.settings {
    margin-bottom: 30px;
}

.settings label {
    font-size: 1.2em;
    color: #333;
    margin-right: 15px;
    font-weight: bold;
}

.settings select {
    padding: 10px 15px;
    font-size: 1.1em;
    border: 2px solid #4a90e2;
    border-radius: 10px;
    background: white;
    color: #333;
}

.settings select:focus {
    outline: none;
    border-color: #f39c12;
    box-shadow: 0 0 10px rgba(243, 156, 18, 0.3);
}

button {
    padding: 15px 30px;
    font-size: 1.2em;
    background: linear-gradient(45deg, #f39c12, #e67e22);
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(243, 156, 18, 0.3);
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(243, 156, 18, 0.4);
}

button:active {
    transform: translateY(0);
}

/* 游戏页面 */
.game-page {
    display: flex;
    width: 100%;
    height: 100vh;
    background: white;
}

.player-area {
    flex: 1;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.player-1 {
    background: linear-gradient(135deg, #74b9ff 0%, #0984e3 100%);
    color: white;
}

.player-2 {
    background: linear-gradient(135deg, #fd79a8 0%, #e84393 100%);
    color: white;
}

.player-area h2 {
    text-align: center;
    margin-bottom: 20px;
    font-size: 2em;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.score-time {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    font-size: 1.2em;
    font-weight: bold;
}

.progress {
    margin-bottom: 30px;
}

.progress span {
    font-size: 1.1em;
    font-weight: bold;
    margin-bottom: 10px;
    display: block;
}

.progress-bar {
    height: 20px;
    background: rgba(255,255,255,0.3);
    border-radius: 10px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #00b894, #00cec9);
    transition: width 0.3s ease;
    border-radius: 10px;
}

.question-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.question-area p {
    font-size: 2.5em;
    font-weight: bold;
    margin-bottom: 40px;
    text-align: center;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    width: 100%;
    max-width: 400px;
}

.option-btn {
    padding: 20px;
    font-size: 1.5em;
    font-weight: bold;
    border: 3px solid white;
    border-radius: 15px;
    background: rgba(255,255,255,0.9);
    color: #333;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.option-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
}

.option-btn.correct {
    background: #00b894;
    color: white;
    border-color: #00b894;
}

.option-btn.incorrect {
    background: linear-gradient(135deg, #ff6b6b, #ee5a52);
    color: white;
    border-color: #ee5a52;
    animation: shake 0.5s ease-in-out;
}

/* 添加点击效果 */
.option-btn:active {
    transform: scale(0.95);
}

/* 添加过渡效果 */
.option-btn, button, .show-wrong-btn, .close-modal {
    transition: all 0.3s ease;
}

/* 添加悬停效果 */
.option-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
}

button:hover, .show-wrong-btn:hover, .close-modal:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.2);
}

.option-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* 游戏状态提示 */
.game-status {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 1.1em;
    font-weight: bold;
}

/* 结果页面 */
.result-page {
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    text-align: center;
    min-width: 600px;
    max-width: 800px;
}

.result-page h1 {
    color: #4a90e2;
    margin-bottom: 30px;
    font-size: 2.5em;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}

.result-summary {
    display: flex;
    justify-content: space-around;
    margin-bottom: 30px;
}

.player-result {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 30px;
    border-radius: 15px;
    min-width: 200px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.player-result h3 {
    color: #495057;
    margin-bottom: 15px;
    font-size: 1.5em;
}

.player-result p {
    margin-bottom: 10px;
    font-size: 1.1em;
    color: #6c757d;
}

.player-result span {
    font-weight: bold;
    color: #4a90e2;
}

.show-wrong-btn {
    background: linear-gradient(45deg, #6c757d, #495057);
    padding: 10px 20px;
    font-size: 1em;
    margin-top: 15px;
}

.show-wrong-btn:hover {
    background: linear-gradient(45deg, #495057, #343a40);
}

/* 错题弹窗 */
.wrong-questions-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.wrong-questions-modal h3 {
    color: white;
    margin-bottom: 20px;
    font-size: 2em;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.wrong-list {
    background: white;
    padding: 30px;
    border-radius: 15px;
    max-width: 600px;
    max-height: 300px;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    -webkit-overflow-scrolling: touch; /* 移动端流畅滚动 */
}

.wrong-item {
    padding: 15px 10px;
    margin-bottom: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #e17055;
    line-height: 1.6;
}

.wrong-question {
    font-size: 1.2em;
    font-weight: bold;
    margin-bottom: 8px;
    color: #495057;
}

.wrong-answer {
    color: #e17055;
    font-weight: bold;
}

.correct-answer {
    color: #00b894;
    font-weight: bold;
}

.close-modal {
    background: linear-gradient(45deg, #6c757d, #495057);
    margin-top: 20px;
}

.close-modal:hover {
    background: linear-gradient(45deg, #495057, #343a40);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .game-page {
        flex-direction: column;
    }
    
    .player-area {
        min-height: 45vh;
    }
    
    .result-summary {
        flex-direction: column;
        gap: 20px;
    }
    
    .setup-page, .result-page {
        margin: 20px;
        min-width: auto;
        width: calc(100% - 40px);
        padding: 20px;
    }
    
    .question-area p {
        font-size: 1.8em;
    }
    
    .option-btn {
        padding: 15px;
        font-size: 1.1em;
    }
    
    .wrong-list {
        max-width: 90%;
        padding: 20px;
        max-height: 80vh;
    }
    
    /* 移动端题目类型和数量选择适配 */
    .type-checkboxes {
        flex-direction: column;
        align-items: center;
    }
    
    .checkbox-item {
        width: 80%;
        justify-content: center;
    }
    
    .count-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .count-btn {
        width: 80%;
        margin-bottom: 10px;
    }
    
    .wrong-item {
        padding: 25px;
        margin-bottom: 20px;
    }
}

@media (max-width: 480px) {
    .options {
        grid-template-columns: 1fr;
        max-width: 250px;
    }
    
    .question-area p {
        font-size: 1.5em;
    }
    
    .setup-page h1, .result-page h1 {
        font-size: 2em;
    }
    
    .score-time {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .wrong-list {
        max-width: 95%;
        padding: 15px;
        max-height: 85vh;
    }
    
    .wrong-item {
        padding: 30px 20px;
        margin-bottom: 25px;
    }
    
    .wrong-questions-modal h3 {
        font-size: 1.5em;
        margin-bottom: 15px;
    }
}