/* ==================== 全局样式 ==================== */
:root {
    --primary-color: #FF6B6B;
    --secondary-color: #4ECDC4;
    --accent-color: #FFE66D;
    --bg-color: #F7F7F7;
    --card-bg: #FFFFFF;
    --text-color: #333333;
    --text-light: #666666;
    --success-color: #51CF66;
    --error-color: #FF6B6B;
    --border-radius: 16px;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ==================== 页面容器 ==================== */
.page {
    min-height: 100vh;
    padding: 20px;
    padding-bottom: 100px;
}

/* ==================== 头部 ==================== */
.header {
    text-align: center;
    margin-bottom: 30px;
}

.title {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.user-info {
    display: flex;
    justify-content: center;
    gap: 20px;
    font-size: 1.1rem;
}

.stars {
    color: var(--accent-color);
    font-weight: bold;
}

/* ==================== 统计卡片 ==================== */
.stats-card {
    display: flex;
    justify-content: space-around;
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--shadow);
    margin-bottom: 30px;
}

.stat-item {
    text-align: center;
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary-color);
}

.stat-label {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-top: 5px;
}

/* ==================== 难度选择 ==================== */
.difficulty-selector {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--shadow);
    margin-bottom: 30px;
}

.difficulty-selector h3 {
    text-align: center;
    margin-bottom: 15px;
    color: var(--text-color);
}

.difficulty-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.diff-btn {
    padding: 12px 24px;
    border: 2px solid var(--secondary-color);
    background: transparent;
    border-radius: 25px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-color);
}

.diff-btn.active {
    background: var(--secondary-color);
    color: white;
}

.diff-btn:hover {
    transform: scale(1.05);
}

/* ==================== 开始按钮 ==================== */
.start-btn {
    display: block;
    width: 100%;
    max-width: 300px;
    margin: 0 auto 30px;
    padding: 18px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    border-radius: 30px;
    font-size: 1.3rem;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.4);
    transition: all 0.3s ease;
}

.start-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(255, 107, 107, 0.5);
}

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

/* ==================== 底部导航 ==================== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    background: var(--card-bg);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
    padding: 10px 0;
    z-index: 100;
}

.nav-btn {
    flex: 1;
    padding: 10px;
    border: none;
    background: transparent;
    font-size: 0.85rem;
    cursor: pointer;
    color: var(--text-light);
    transition: color 0.3s ease;
}

.nav-btn.active {
    color: var(--primary-color);
    font-weight: bold;
}

/* ==================== 练习页 ==================== */
.practice-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.back-btn {
    padding: 10px 15px;
    border: none;
    background: var(--card-bg);
    border-radius: 20px;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: var(--shadow);
}

.timer {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--secondary-color);
}

.progress {
    font-size: 1rem;
    color: var(--text-light);
}

.question-card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 40px 20px;
    box-shadow: var(--shadow);
    text-align: center;
    margin-bottom: 30px;
}

.question-text {
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--text-color);
    margin-bottom: 15px;
}

.question-hint {
    font-size: 1rem;
    color: var(--text-light);
    padding: 10px;
    background: #FFF9E6;
    border-radius: 10px;
    margin-top: 15px;
}

.answer-section {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

.answer-input {
    flex: 1;
    padding: 18px;
    font-size: 1.5rem;
    border: 3px solid #E0E0E0;
    border-radius: 15px;
    text-align: center;
    outline: none;
    transition: border-color 0.3s ease;
}

.answer-input:focus {
    border-color: var(--secondary-color);
}

.submit-btn {
    padding: 18px 30px;
    background: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 15px;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.submit-btn:hover {
    background: #45B7AA;
}

.feedback {
    text-align: center;
    padding: 15px;
    border-radius: 10px;
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 20px;
}

.feedback.correct {
    background: #E8F5E9;
    color: var(--success-color);
}

.feedback.wrong {
    background: #FFEBEE;
    color: var(--error-color);
}

/* ==================== 操作按钮 ==================== */
.action-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
}

.hint-btn {
    padding: 12px 24px;
    border: 2px dashed var(--text-light);
    background: transparent;
    border-radius: 25px;
    font-size: 1rem;
    cursor: pointer;
    color: var(--text-light);
}

.speech-btn {
    padding: 12px 24px;
    border: 2px solid var(--secondary-color);
    background: transparent;
    border-radius: 25px;
    font-size: 1rem;
    cursor: pointer;
    color: var(--secondary-color);
    transition: all 0.3s ease;
}

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

/* ==================== 限时挑战 ==================== */
.challenge-btn {
    display: block;
    width: 100%;
    max-width: 300px;
    margin: 0 auto 30px;
    padding: 15px;
    background: linear-gradient(135deg, #FF9800, #FF5722);
    color: white;
    border: none;
    border-radius: 30px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(255, 152, 0, 0.4);
    transition: all 0.3s ease;
}

.challenge-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 152, 0, 0.5);
}

.challenge-timer {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--secondary-color);
}

.timer-warning {
    color: var(--error-color) !important;
    animation: pulse 1s infinite;
}

.score {
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--primary-color);
}

/* ==================== 宠物页 ==================== */
.pet-container {
    text-align: center;
    padding: 20px;
}

.pet-avatar {
    font-size: 6rem;
    margin-bottom: 10px;
    animation: bounce 2s ease infinite;
}

.pet-name {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--text-color);
    margin-bottom: 5px;
}

.pet-level {
    font-size: 1.1rem;
    color: var(--secondary-color);
    margin-bottom: 30px;
}

.pet-stats {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.pet-stat {
    margin-bottom: 15px;
}

.pet-stat .stat-label {
    font-size: 1rem;
    margin-bottom: 8px;
    text-align: left;
}

.progress-bar {
    height: 20px;
    background: #E0E0E0;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 5px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    border-radius: 10px;
    transition: width 0.5s ease;
}

.progress-fill.exp {
    background: linear-gradient(90deg, #FFD700, #FFA500);
}

.pet-stat .stat-value {
    font-size: 0.9rem;
    color: var(--text-light);
    text-align: right;
}

.pet-actions {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
}

.feed-btn,
.play-btn {
    padding: 15px 30px;
    border: none;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

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

.feed-btn:disabled {
    background: #CCC;
    cursor: not-allowed;
}

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

.feed-btn:hover:not(:disabled),
.play-btn:hover {
    transform: scale(1.05);
}

.pet-info {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 15px;
    box-shadow: var(--shadow);
}

.pet-info p {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 5px;
}

/* ==================== 结果页 ==================== */
.result-page {
    display: flex;
    align-items: center;
    justify-content: center;
    padding-bottom: 20px;
}

.result-card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 40px 30px;
    box-shadow: var(--shadow);
    text-align: center;
    max-width: 400px;
    width: 100%;
}

.result-emoji {
    font-size: 5rem;
    margin-bottom: 20px;
}

.result-title {
    font-size: 1.8rem;
    color: var(--primary-color);
    margin-bottom: 30px;
}

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

.result-stat {
    background: var(--bg-color);
    padding: 15px;
    border-radius: 12px;
}

.stat-num {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--secondary-color);
}

.stat-desc {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-top: 5px;
}

.result-wrong {
    margin-bottom: 25px;
    color: var(--error-color);
}

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

.btn-primary {
    padding: 16px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 25px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    transform: scale(1.02);
}

.btn-secondary {
    padding: 16px;
    background: transparent;
    color: var(--text-light);
    border: 2px solid #E0E0E0;
    border-radius: 25px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    border-color: var(--text-light);
}

/* ==================== 错题本 ==================== */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.page-header h2 {
    font-size: 1.5rem;
}

.clear-btn {
    padding: 8px 16px;
    border: none;
    background: var(--error-color);
    color: white;
    border-radius: 20px;
    font-size: 0.9rem;
    cursor: pointer;
}

.wrong-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.wrong-item {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--shadow);
}

.wrong-question {
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 10px;
}

.wrong-answer {
    font-size: 1rem;
    color: var(--text-light);
    margin-bottom: 15px;
}

.user-ans {
    color: var(--error-color);
    font-weight: bold;
}

.correct-ans {
    color: var(--success-color);
    font-weight: bold;
}

.retry-btn {
    padding: 10px 20px;
    background: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 20px;
    font-size: 1rem;
    cursor: pointer;
}

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

.empty-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.empty-state p {
    font-size: 1.2rem;
    color: var(--text-light);
}

/* ==================== 成就页 ==================== */
.achievements-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.achievement-card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--shadow);
    text-align: center;
    opacity: 0.5;
    transition: all 0.3s ease;
}

.achievement-card.unlocked {
    opacity: 1;
    border: 3px solid var(--accent-color);
}

.achievement-icon {
    font-size: 3rem;
    margin-bottom: 10px;
}

.achievement-name {
    font-size: 1.1rem;
    font-weight: bold;
    margin-bottom: 5px;
}

.achievement-desc {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 10px;
}

.achievement-reward {
    font-size: 1rem;
    color: var(--accent-color);
    font-weight: bold;
}

/* ==================== 家长面板 ==================== */
.parent-stats {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 25px;
    box-shadow: var(--shadow);
}

.parent-stats h3 {
    margin-bottom: 20px;
    color: var(--text-color);
}

.weekly-chart {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    height: 200px;
    padding: 20px 0;
    border-bottom: 2px solid #E0E0E0;
    margin-bottom: 25px;
}

.chart-bar {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    justify-content: flex-end;
}

.bar-fill {
    width: 30px;
    background: linear-gradient(to top, var(--primary-color), var(--secondary-color));
    border-radius: 8px 8px 0 0;
    min-height: 10px;
    transition: height 0.5s ease;
}

.bar-label {
    margin-top: 10px;
    font-size: 0.85rem;
    color: var(--text-light);
}

.summary-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 30px;
}

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

.summary-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--secondary-color);
}

.summary-label {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-top: 5px;
}

.weak-points {
    margin-top: 25px;
}

.weak-points h3 {
    margin-bottom: 15px;
}

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

.weak-item {
    display: flex;
    justify-content: space-between;
    padding: 12px 15px;
    background: #FFF3F3;
    border-radius: 10px;
}

.weak-type {
    font-weight: bold;
    color: var(--error-color);
}

.weak-count {
    color: var(--text-light);
}

.no-weak {
    text-align: center;
    color: var(--success-color);
    padding: 20px;
}

/* ==================== 登录页 ==================== */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.login-card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 40px 30px;
    box-shadow: var(--shadow);
    text-align: center;
    max-width: 400px;
    width: 100%;
}

.login-card h2 {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.login-card p {
    color: var(--text-light);
    margin-bottom: 30px;
}

.login-input {
    display: block;
    width: 100%;
    padding: 16px;
    margin-bottom: 15px;
    border: 2px solid #E0E0E0;
    border-radius: 12px;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.3s ease;
}

.login-input:focus {
    border-color: var(--secondary-color);
}

.login-btn {
    display: block;
    width: 100%;
    padding: 16px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 25px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    margin-bottom: 12px;
    transition: all 0.3s ease;
}

.login-btn:hover {
    background: #FF5252;
}

.register-btn {
    display: block;
    width: 100%;
    padding: 16px;
    background: transparent;
    color: var(--secondary-color);
    border: 2px solid var(--secondary-color);
    border-radius: 25px;
    font-size: 1.1rem;
    cursor: pointer;
    margin-bottom: 12px;
    transition: all 0.3s ease;
}

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

.skip-btn {
    background: transparent;
    border: none;
    color: var(--text-light);
    font-size: 0.9rem;
    cursor: pointer;
    text-decoration: underline;
}

/* ==================== 响应式 ==================== */
@media (max-width: 480px) {
    .title {
        font-size: 1.6rem;
    }

    .stat-value {
        font-size: 1.5rem;
    }

    .question-text {
        font-size: 2rem;
    }

    .result-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .achievements-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .summary-cards {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }
}
