/* 全局样式重置 */
* {
    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;
    overflow-x: hidden;
}

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

/* 头部样式 */
.header {
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 50%, #fecfef 100%);
    padding: 20px 0;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.logo h1 {
    font-size: 2.5rem;
    color: #fff;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
    font-weight: bold;
    letter-spacing: 2px;
}

.subtitle {
    font-size: 1rem;
    color: #fff;
    opacity: 0.9;
}

/* 导航菜单 */
.navigation {
    margin-top: 10px;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 20px;
    flex-wrap: wrap;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 25px;
    color: #667eea;
    text-decoration: none;
    font-weight: bold;
    transition: all 0.3s ease;
    cursor: pointer;
}

.nav-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
    background: #fff;
}

.nav-item.active {
    background: #fff;
    color: #ff6b6b;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.nav-item .icon {
    font-size: 1.5rem;
}

/* 主要内容区域 */
.main-content {
    padding: 40px 0;
    min-height: calc(100vh - 300px);
}

.section {
    display: none;
    animation: fadeIn 0.5s ease-in-out;
}

.section.active {
    display: block;
}

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

.section-header {
    text-align: center;
    margin-bottom: 40px;
    color: #fff;
}

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

.section-header p {
    font-size: 1.2rem;
    opacity: 0.9;
}

/* ==================== 模式切换标签 ==================== */
.mode-tabs {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.mode-tab {
    padding: 12px 30px;
    font-size: 1.1rem;
    border: 2px solid rgba(255,255,255,0.5);
    border-radius: 25px;
    background: rgba(255,255,255,0.15);
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
}

.mode-tab:hover {
    background: rgba(255,255,255,0.3);
    border-color: #fff;
}

.mode-tab.active {
    background: #fff;
    color: #667eea;
    border-color: #fff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* ==================== 趣味计算板块样式 ==================== */
.math-game-container {
    background: #fff;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 40px;
    max-width: 900px;
    margin: 0 auto;
}

.game-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
}

.question-box {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 40px;
    border-radius: 15px;
    width: 100%;
    text-align: center;
    color: #fff;
}

.question-number {
    font-size: 1.2rem;
    margin-bottom: 20px;
    opacity: 0.9;
}

.math-problem {
    font-size: 3rem;
    font-weight: bold;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
}

#answer-display, [id$="-answer-display"] {
    background: rgba(255, 255, 255, 0.2);
    padding: 10px 20px;
    border-radius: 10px;
    min-width: 80px;
}

.options-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    width: 100%;
}

.option-btn {
    padding: 20px;
    font-size: 1.5rem;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
}

.option-btn:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

.option-btn:disabled {
    cursor: not-allowed;
    opacity: 0.8;
}

.option-btn.correct {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    animation: pulse 0.5s ease;
}

.option-btn.wrong {
    background: linear-gradient(135deg, #eb3349 0%, #f45c43 100%);
    animation: shake 0.5s ease;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.score-board {
    display: flex;
    gap: 40px;
    background: #f8f9fa;
    padding: 20px 40px;
    border-radius: 12px;
    width: 100%;
    justify-content: center;
}

.score-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.2rem;
}

.score-item .label {
    color: #666;
}

.score-item .value {
    font-size: 2rem;
    font-weight: bold;
    color: #667eea;
}

.feedback {
    font-size: 1.5rem;
    font-weight: bold;
    min-height: 40px;
    text-align: center;
}

.btn-primary {
    padding: 15px 40px;
    font-size: 1.2rem;
    border: none;
    border-radius: 25px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

.difficulty-selector {
    background: #f8f9fa;
    padding: 30px;
    border-radius: 15px;
    text-align: center;
}

.difficulty-selector h3 {
    margin-bottom: 20px;
    color: #333;
    font-size: 1.3rem;
}

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

.difficulty-btn {
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
}

.difficulty-btn:hover {
    border-color: #667eea;
    background: #f0f0ff;
}

.difficulty-btn.active {
    border-color: #667eea;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}

/* ==================== 测试进度条 ==================== */
.test-progress-bar {
    width: 100%;
    height: 12px;
    background: #dfe6e9;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 15px;
}

.test-progress-fill {
    height: 100%;
    background: linear-gradient(135deg, #ff7675 0%, #d63031 100%);
    width: 0%;
    transition: width 0.5s ease;
    border-radius: 6px;
}

.test-info {
    display: flex;
    justify-content: space-between;
    width: 100%;
    font-size: 1.1rem;
    color: #636e72;
    margin-bottom: 15px;
}

/* ==================== 测试结果弹窗 ==================== */
.test-result-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    z-index: 2500;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.test-result-card {
    background: #fff;
    border-radius: 20px;
    padding: 40px;
    max-width: 500px;
    width: 100%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
    from { transform: scale(0.5); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.test-result-icon {
    font-size: 5rem;
    margin-bottom: 15px;
}

.test-result-card h3 {
    font-size: 1.8rem;
    color: #2d3436;
    margin-bottom: 25px;
}

.test-result-stats {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

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

.result-label {
    display: block;
    color: #636e72;
    font-size: 0.9rem;
    margin-bottom: 5px;
}

.result-value {
    display: block;
    font-size: 2rem;
    font-weight: bold;
    color: #667eea;
}

/* ==================== 解锁通知 ==================== */
.unlock-notification {
    background: linear-gradient(135deg, #ffeaa7 0%, #fdcb6e 100%);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    font-size: 1.1rem;
    color: #2d3436;
    font-weight: bold;
}

.global-unlock-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.75);
    z-index: 3000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.global-unlock-card {
    background: linear-gradient(135deg, #2d3436 0%, #636e72 100%);
    border-radius: 20px;
    padding: 40px;
    max-width: 450px;
    width: 100%;
    text-align: center;
    color: #fff;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    animation: popIn 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 3px solid #fdcb6e;
}

.global-unlock-card .unlock-fireworks {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.global-unlock-card h3 {
    font-size: 1.8rem;
    margin-bottom: 15px;
    color: #fdcb6e;
}

.global-unlock-card p {
    font-size: 1.2rem;
    margin-bottom: 25px;
    color: #dfe6e9;
}

.unlock-status {
    margin-top: 15px;
    font-size: 1.1rem;
}

.unlock-status strong {
    color: #fdcb6e;
    font-size: 1.4rem;
}

/* ==================== 开心识字板块样式 ==================== */
.literacy-container {
    background: #fff;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    max-width: 900px;
    margin: 0 auto;
}

.character-display {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 40px;
    margin-bottom: 30px;
}

.character-card {
    background: linear-gradient(135deg, #ffeaa7 0%, #fdcb6e 100%);
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 300px;
}

.character-main {
    font-size: 8rem;
    font-weight: bold;
    color: #d63031;
    line-height: 1;
    margin-bottom: 20px;
}

.character-pinyin {
    font-size: 2rem;
    color: #6c5ce7;
    margin-bottom: 10px;
}

.character-meaning {
    font-size: 1.2rem;
    color: #636e72;
}

.character-info h3 {
    color: #2d3436;
    margin-bottom: 15px;
    font-size: 1.3rem;
}

.character-info p {
    color: #636e72;
    line-height: 1.8;
    margin-bottom: 20px;
}

.word-examples {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.word-tag {
    background: linear-gradient(135deg, #74b9ff 0%, #0984e3 100%);
    color: #fff;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 1rem;
}

.control-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.btn-secondary {
    padding: 12px 30px;
    font-size: 1.1rem;
    border: none;
    border-radius: 25px;
    background: linear-gradient(135deg, #a29bfe 0%, #6c5ce7 100%);
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.btn-accent {
    padding: 12px 30px;
    font-size: 1.1rem;
    border: none;
    border-radius: 25px;
    background: linear-gradient(135deg, #fd79a8 0%, #e84393 100%);
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-accent:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

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

.progress-fill {
    height: 100%;
    background: linear-gradient(135deg, #00b894 0%, #00cec9 100%);
    width: 2%;
    transition: width 0.3s ease;
}

.progress-text {
    text-align: center;
    color: #636e72;
    font-size: 1rem;
}

/* ==================== 游戏乐园板块样式 ==================== */
.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 25px;
    max-width: 1100px;
    margin: 0 auto;
}

.game-card {
    background: #fff;
    border-radius: 20px;
    padding: 30px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.game-card:hover:not(.locked) {
    transform: translateY(-10px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
}

/* 已解锁游戏样式 */
.game-card.unlocked {
    border: 2px solid transparent;
}

.game-card.unlocked:hover {
    border-color: #667eea;
}

/* 锁定游戏样式 */
.game-card.locked {
    cursor: not-allowed;
    filter: grayscale(100%);
    opacity: 0.5;
    background: #e8e8e8;
}

.game-card.locked:hover {
    transform: none;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.game-card.locked .game-icon {
    filter: grayscale(100%);
}

.lock-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    background: #636e72;
    color: #fff;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.unlock-hint {
    font-size: 0.85rem;
    color: #b2bec3;
    margin-top: 8px;
    font-style: italic;
}

.game-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    transition: transform 0.3s ease;
}

.game-card.unlocked:hover .game-icon {
    transform: scale(1.15);
}

.game-card h3 {
    color: #2d3436;
    font-size: 1.4rem;
    margin-bottom: 12px;
}

.game-card p {
    color: #636e72;
    margin-bottom: 20px;
    line-height: 1.6;
    font-size: 0.95rem;
}

.btn-play {
    padding: 12px 30px;
    font-size: 1.1rem;
    border: none;
    border-radius: 25px;
    background: linear-gradient(135deg, #ff7675 0%, #d63031 100%);
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
}

.btn-play:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
}

.game-card.locked .btn-play {
    background: #b2bec3;
    cursor: not-allowed;
    pointer-events: none;
}

/* ==================== 模态框样式 ==================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: #fff;
    border-radius: 20px;
    padding: 40px;
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 2rem;
    color: #636e72;
    cursor: pointer;
    transition: all 0.3s ease;
}

.close-btn:hover {
    color: #d63031;
    transform: rotate(90deg);
}

/* ==================== Canvas 游戏容器 ==================== */
.canvas-game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.canvas-game-container canvas {
    border: 3px solid #ddd;
    border-radius: 15px;
    background: #f8f9fa;
}

.game-controls {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
}

.game-score-display {
    font-size: 1.3rem;
    font-weight: bold;
    color: #667eea;
}

/* ==================== 页脚样式 ==================== */
.footer {
    background: rgba(255, 255, 255, 0.1);
    padding: 30px 0;
    text-align: center;
    color: #fff;
    margin-top: 40px;
}

.footer p {
    font-size: 1rem;
    margin-bottom: 10px;
}

.tagline {
    font-size: 1.2rem;
    font-style: italic;
    opacity: 0.9;
}

/* ==================== 响应式设计 ==================== */
@media (max-width: 768px) {
    .header .container {
        flex-direction: column;
        text-align: center;
    }
    
    .logo h1 {
        font-size: 2rem;
    }
    
    .nav-menu {
        justify-content: center;
    }
    
    .nav-item {
        padding: 10px 16px;
        font-size: 0.9rem;
    }
    
    .section-header h2 {
        font-size: 2rem;
    }
    
    .math-game-container {
        grid-template-columns: 1fr;
        padding: 20px;
    }
    
    .math-problem {
        font-size: 2rem;
    }
    
    .options-container {
        grid-template-columns: 1fr 1fr;
    }
    
    .character-display {
        grid-template-columns: 1fr;
    }
    
    .character-main {
        font-size: 6rem;
    }
    
    .games-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
    
    .control-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .btn-primary,
    .btn-secondary,
    .btn-accent {
        width: 100%;
        max-width: 300px;
    }

    .test-result-stats {
        flex-direction: column;
        gap: 15px;
    }

    .mode-tabs {
        flex-direction: column;
        align-items: center;
    }
    
    .modal-content {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .logo h1 {
        font-size: 1.5rem;
    }
    
    .subtitle {
        font-size: 0.9rem;
    }
    
    .nav-item {
        padding: 8px 12px;
        font-size: 0.8rem;
    }
    
    .nav-item .icon {
        font-size: 1.2rem;
    }
    
    .section-header h2 {
        font-size: 1.5rem;
    }
    
    .question-box {
        padding: 20px;
    }
    
    .math-problem {
        font-size: 1.5rem;
    }
    
    .option-btn {
        padding: 15px;
        font-size: 1.2rem;
    }
    
    .score-board {
        flex-direction: column;
        gap: 15px;
        padding: 15px 20px;
    }
    
    .character-card {
        padding: 20px;
    }
    
    .character-main {
        font-size: 5rem;
    }
    
    .modal-content {
        padding: 20px;
    }

    .games-grid {
        grid-template-columns: 1fr;
    }

    .game-card {
        padding: 20px;
    }
}
