/* ============================================
   9×9乘法练习工具 - 基础样式
   ============================================ */

* {
    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;
    line-height: 1.6;
    min-height: 100vh;
}

.page {
    display: none;
    min-height: 100vh;
}

.page.active {
    display: block;
}

.section {
    display: none;
    padding: 20px;
    max-width: 800px;
    margin: 0 auto;
}

.section.active {
    display: block;
}

/* ============================================
   登录/注册页面
   ============================================ */

.auth-container {
    max-width: 400px;
    margin: 80px auto;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.app-title {
    text-align: center;
    font-size: 28px;
    margin-bottom: 30px;
    color: #333;
}

.auth-tabs {
    display: flex;
    margin-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
}

.tab-btn {
    flex: 1;
    padding: 12px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    color: #666;
    transition: all 0.3s;
}

.tab-btn.active {
    color: #1890ff;
    border-bottom: 2px solid #1890ff;
    margin-bottom: -2px;
}

.auth-form {
    display: none;
}

.auth-form.active {
    display: block;
}

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

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

.form-group input {
    width: 100%;
    padding: 12px;
    border: 1px solid #d9d9d9;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: #1890ff;
}

.btn-primary {
    width: 100%;
    padding: 12px;
    background: #1890ff;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-primary:hover {
    background: #40a9ff;
}

.btn-secondary {
    padding: 10px 20px;
    background: #f0f0f0;
    color: #333;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.3s;
}

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

.btn-small {
    padding: 6px 12px;
    background: #f5f5f5;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
}

.message {
    margin-top: 15px;
    padding: 10px;
    border-radius: 4px;
    text-align: center;
    display: none;
}

.message.error {
    display: block;
    background: #fff2f0;
    color: #ff4d4f;
    border: 1px solid #ffccc7;
}

.message.success {
    display: block;
    background: #f6ffed;
    color: #52c41a;
    border: 1px solid #b7eb8f;
}

/* ============================================
   主应用页面
   ============================================ */

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.user-info {
    font-size: 16px;
    color: #333;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.theme-selector {
    padding: 6px 10px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    font-size: 13px;
}

.main-content {
    padding: 20px;
}

h2 {
    font-size: 24px;
    margin-bottom: 20px;
    color: #333;
}

/* ============================================
   模式选择
   ============================================ */

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

.mode-card {
    padding: 30px 20px;
    border-radius: 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    border: 2px solid transparent;
}

.mode-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.mode-icon {
    font-size: 48px;
    margin-bottom: 15px;
    font-weight: bold;
}

.mode-card h3 {
    font-size: 18px;
    margin-bottom: 8px;
    color: #333;
}

.mode-card p {
    font-size: 14px;
    color: #666;
}

.question-count-setting {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px;
    background: #f5f5f5;
    border-radius: 8px;
}

.question-count-setting label {
    font-weight: 500;
}

.question-count-setting select,
.question-count-setting input {
    padding: 8px 12px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    font-size: 14px;
}

/* ============================================
   练习页面
   ============================================ */

.practice-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: #f5f5f5;
    border-radius: 8px;
    margin-bottom: 20px;
}

.progress {
    font-size: 16px;
    font-weight: 500;
}

.timer {
    font-size: 16px;
    color: #1890ff;
}

.questions-list {
    display: grid;
    gap: 15px;
    margin-bottom: 20px;
}

.question-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.question-number {
    font-weight: bold;
    color: #666;
    min-width: 40px;
}

.question-text {
    font-size: 18px;
    flex: 1;
}

.answer-input {
    width: 100px;
    padding: 8px;
    border: 2px solid #d9d9d9;
    border-radius: 6px;
    font-size: 16px;
    text-align: center;
}

.answer-input:focus {
    outline: none;
    border-color: #1890ff;
}

.practice-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
}

.practice-actions button {
    min-width: 120px;
}

/* ============================================
   结果页面
   ============================================ */

.result-summary {
    text-align: center;
    padding: 30px;
    background: white;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

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

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

.score-label {
    font-size: 18px;
    color: #666;
}

.result-stats {
    font-size: 16px;
    color: #333;
}

.result-stats p {
    margin: 10px 0;
}

.encouragement {
    padding: 20px;
    background: #e6f7ff;
    border-radius: 8px;
    text-align: center;
    font-size: 18px;
    color: #1890ff;
    margin-bottom: 20px;
    font-weight: 500;
}

.result-details h3 {
    margin-bottom: 15px;
    color: #333;
}

.answer-list {
    display: grid;
    gap: 10px;
    margin-bottom: 20px;
}

.answer-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: white;
    border-radius: 6px;
    border-left: 4px solid #d9d9d9;
}

.answer-item.correct {
    border-left-color: #52c41a;
    background: #f6ffed;
}

.answer-item.wrong {
    border-left-color: #ff4d4f;
    background: #fff2f0;
}

.answer-mark {
    font-size: 24px;
    font-weight: bold;
    min-width: 30px;
}

.answer-item.correct .answer-mark {
    color: #52c41a;
}

.answer-item.wrong .answer-mark {
    color: #ff4d4f;
}

.answer-detail {
    flex: 1;
}

.answer-question {
    font-size: 16px;
    margin-bottom: 5px;
}

.answer-comparison {
    font-size: 14px;
    color: #666;
}

.result-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

/* ============================================
   错题本页面
   ============================================ */

.wrongbook-filters {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.filter-btn {
    padding: 8px 16px;
    background: white;
    border: 1px solid #d9d9d9;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
}

.filter-btn.active {
    background: #1890ff;
    color: white;
    border-color: #1890ff;
}

.wrong-answers-list {
    display: grid;
    gap: 12px;
    margin-bottom: 20px;
}

.wrong-item {
    padding: 15px;
    background: white;
    border-radius: 8px;
    border-left: 4px solid #ff4d4f;
}

.wrong-question {
    font-size: 16px;
    margin-bottom: 8px;
    font-weight: 500;
}

.wrong-comparison {
    display: flex;
    gap: 20px;
    font-size: 14px;
    margin-bottom: 8px;
}

.wrong-user {
    color: #ff4d4f;
}

.wrong-correct {
    color: #52c41a;
}

.wrong-meta {
    font-size: 12px;
    color: #999;
    margin-bottom: 10px;
}

.wrong-actions {
    display: flex;
    gap: 10px;
}

.wrong-actions button {
    padding: 6px 12px;
    font-size: 13px;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.empty-state p {
    font-size: 16px;
}

/* ============================================
   响应式设计
   ============================================ */

@media (max-width: 768px) {
    .auth-container {
        margin: 40px 20px;
        padding: 30px 20px;
    }
    
    .mode-grid {
        grid-template-columns: 1fr;
    }
    
    .question-item {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .answer-input {
        width: 100%;
    }
    
    .result-actions {
        flex-direction: column;
    }
    
    .result-actions button {
        width: 100%;
    }
}
