/* ============================================================
   english.css - 英语模块专属样式
   颜色主题：英语紫（--english-color: #9B59B6）
   ============================================================ */

/* ===== 英语模块容器 ===== */
.page-english {
    padding-top: 0;
}

/* ===== 子模块 Tab 颜色覆盖（英语紫） ===== */
.page-english .sub-tab.active {
    background: linear-gradient(135deg, var(--english-color) 0%, #6B3B7A 100%);
    color: white;
    box-shadow: var(--shadow-medium);
}

/* ===== 英语模块按钮主题色覆盖 ===== */
.page-english .action-btn {
    background: linear-gradient(135deg, var(--english-color) 0%, #6B3B7A 100%);
    border-color: white;
}

/* ============================================================
   一、字母卡片 - 字母列表
   ============================================================ */
.alphabet-view {
    animation: pageFadeIn 0.3s ease;
}

.alphabet-list-header {
    text-align: center;
    margin-bottom: 20px;
}

.alphabet-list-header h2 {
    font-size: 36px;
    color: var(--english-color);
    text-shadow: 0 2px 0 rgba(155, 89, 182, 0.2);
}

.alphabet-list-header p {
    font-size: 18px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* 字母网格 7 列 */
.alphabet-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 10px;
    background: rgba(255, 255, 255, 0.6);
    padding: 14px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
}

.letter-tile {
    aspect-ratio: 1;
    background: linear-gradient(135deg, #FFFFFF 0%, #F3E5F5 100%);
    border: 3px solid var(--english-color);
    border-radius: var(--radius-md);
    font-size: 32px;
    font-family: 'Fredoka', sans-serif;
    font-weight: 700;
    color: var(--english-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    box-shadow: var(--shadow-soft);
    position: relative;
    line-height: 1;
}

.letter-tile .tile-lower {
    font-size: 18px;
    opacity: 0.7;
    margin-top: 2px;
}

.letter-tile:hover {
    transform: translateY(-3px) scale(1.08);
    box-shadow: var(--shadow-medium);
    background: linear-gradient(135deg, #FFFFFF 0%, #E1BEE7 100%);
}

.letter-tile.completed {
    background: linear-gradient(135deg, #E8F5E9 0%, #C8E6C9 100%);
    border-color: var(--grass-primary);
    color: var(--grass-deep);
}

.letter-tile.completed::after {
    content: '✓';
    position: absolute;
    top: -6px;
    right: -6px;
    width: 22px;
    height: 22px;
    background: var(--grass-primary);
    color: white;
    border-radius: 50%;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-soft);
}

/* ============================================================
   字母详情视图
   ============================================================ */
.letter-detail-view {
    animation: pageFadeIn 0.4s ease;
}

.letter-card-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 24px;
}

.letter-card {
    width: 240px;
    height: 280px;
    margin-bottom: 16px;
    background: linear-gradient(135deg, #F3E5F5 0%, #E1BEE7 100%);
    border: 6px solid var(--english-color);
    border-radius: var(--radius-xl);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-medium);
    animation: letterPop 0.4s ease;
}

@keyframes letterPop {
    0% { transform: scale(0.5); opacity: 0; }
    60% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

.letter-upper {
    font-size: 160px;
    font-family: 'Fredoka', sans-serif;
    font-weight: 700;
    color: var(--english-color);
    line-height: 1;
    text-shadow: 4px 4px 0 rgba(155, 89, 182, 0.2);
}

.letter-lower {
    font-size: 80px;
    font-family: 'Fredoka', sans-serif;
    font-weight: 700;
    color: #6B3B7A;
    line-height: 1;
    margin-top: -10px;
}

.letter-actions {
    display: flex;
    gap: 12px;
}

/* 例词展示 */
.word-section {
    background: var(--bg-card);
    padding: 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    margin-bottom: 20px;
    border-top: 6px solid var(--english-color);
}

.word-section h3 {
    font-size: 26px;
    color: var(--english-color);
    margin-bottom: 16px;
    text-align: center;
}

.word-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
}

.word-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 8px;
    background: linear-gradient(135deg, #FFF8E7 0%, #FFE9B0 100%);
    border: 3px solid var(--english-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: var(--shadow-soft);
}

.word-item:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: var(--shadow-medium);
}

.word-emoji {
    font-size: 48px;
    line-height: 1;
    margin-bottom: 6px;
}

.word-en {
    font-size: 24px;
    font-family: 'Fredoka', sans-serif;
    font-weight: 700;
    color: var(--english-color);
}

.word-cn {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* 字母描红 Canvas */
.letter-trace-section {
    background: var(--bg-card);
    padding: 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    margin-bottom: 20px;
    border-top: 6px solid var(--english-color);
    text-align: center;
}

.letter-trace-section h3 {
    font-size: 26px;
    color: var(--english-color);
    margin-bottom: 16px;
}

#letterCanvas {
    display: block;
    margin: 0 auto 16px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-soft);
    cursor: crosshair;
    touch-action: none;
    background: #FFF8E7;
}

.letter-controls {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* ============================================================
   二、字母消消乐
   ============================================================ */
.match-view {
    animation: pageFadeIn 0.4s ease;
}

.match-header {
    text-align: center;
    margin-bottom: 16px;
}

.match-header h2 {
    font-size: 32px;
    color: var(--english-color);
    margin-bottom: 4px;
}

.match-header p {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.match-stats {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-bottom: 16px;
}

/* 模式切换 */
.match-modes {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 16px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: var(--radius-md);
}

.mode-btn {
    padding: 8px 14px;
    background: var(--bg-card);
    border: 2px solid var(--text-secondary);
    border-radius: var(--radius-full);
    font-size: 14px;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.mode-btn:hover {
    border-color: var(--english-color);
    color: var(--english-color);
}

.mode-btn.active {
    background: var(--english-color);
    border-color: var(--english-color);
    color: white;
    box-shadow: var(--shadow-soft);
}

/* 卡片网格 */
.match-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 20px;
    perspective: 1000px;
}

.match-card {
    aspect-ratio: 1;
    cursor: pointer;
    perspective: 800px;
}

.match-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
}

.match-card.flipped .match-card-inner,
.match-card.matched .match-card-inner {
    transform: rotateY(180deg);
}

.match-card-front,
.match-card-back {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-soft);
    border: 3px solid var(--english-color);
}

.match-card-front {
    background: linear-gradient(135deg, var(--english-color) 0%, #6B3B7A 100%);
    color: white;
    font-size: 36px;
}

.match-card-back {
    background: linear-gradient(135deg, #FFFFFF 0%, #F3E5F5 100%);
    color: var(--english-color);
    transform: rotateY(180deg);
    font-size: 40px;
    font-family: 'Fredoka', sans-serif;
    font-weight: 700;
}

.match-card.matched .match-card-back {
    background: linear-gradient(135deg, var(--grass-primary) 0%, var(--grass-deep) 100%);
    color: white;
    border-color: var(--grass-primary);
    animation: matchedPulse 0.5s ease;
}

.match-card.wrong .match-card-back {
    background: linear-gradient(135deg, var(--chinese-color) 0%, #C0392B 100%);
    color: white;
    border-color: var(--chinese-color);
    animation: shakeX 0.4s ease-in-out;
}

@keyframes matchedPulse {
    0% { transform: rotateY(180deg) scale(1); }
    50% { transform: rotateY(180deg) scale(1.15); }
    100% { transform: rotateY(180deg) scale(1); }
}

.match-controls {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* ============================================================
   三、数字点读
   ============================================================ */
.numbers-view {
    animation: pageFadeIn 0.3s ease;
}

.numbers-header {
    text-align: center;
    margin-bottom: 20px;
}

.numbers-header h2 {
    font-size: 36px;
    color: var(--english-color);
    text-shadow: 0 2px 0 rgba(155, 89, 182, 0.2);
}

.numbers-header p {
    font-size: 18px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.numbers-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
}

.number-en-card-list {
    aspect-ratio: 1;
    background: linear-gradient(135deg, #FFFFFF 0%, #F3E5F5 100%);
    border: 3px solid var(--english-color);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    box-shadow: var(--shadow-soft);
    position: relative;
    cursor: pointer;
}

.number-en-card-list:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: var(--shadow-medium);
}

.number-en-card-list.completed {
    background: linear-gradient(135deg, #E8F5E9 0%, #C8E6C9 100%);
    border-color: var(--grass-primary);
}

.number-en-card-list.completed::after {
    content: '✓';
    position: absolute;
    top: -6px;
    right: -6px;
    width: 22px;
    height: 22px;
    background: var(--grass-primary);
    color: white;
    border-radius: 50%;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.list-digit {
    font-size: 44px;
    font-family: 'Fredoka', sans-serif;
    font-weight: 700;
    color: var(--english-color);
    line-height: 1;
}

.list-word {
    font-size: 16px;
    font-family: 'Fredoka', sans-serif;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* 数字详情 */
.number-en-detail {
    animation: pageFadeIn 0.4s ease;
}

.number-en-card {
    width: 240px;
    height: 240px;
    margin: 0 auto 16px;
    background: linear-gradient(135deg, #F3E5F5 0%, #E1BEE7 100%);
    border: 6px solid var(--english-color);
    border-radius: var(--radius-xl);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-medium);
    animation: numberPop 0.4s ease;
}

.number-en-digit {
    font-size: 120px;
    font-family: 'Fredoka', sans-serif;
    font-weight: 700;
    color: var(--english-color);
    line-height: 1;
    text-shadow: 4px 4px 0 rgba(155, 89, 182, 0.2);
}

.number-en-word {
    font-size: 36px;
    font-family: 'Fredoka', sans-serif;
    font-weight: 700;
    color: #6B3B7A;
    margin-top: 4px;
}

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

.count-en-area {
    min-height: 120px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px;
    background: rgba(155, 89, 182, 0.08);
    border-radius: var(--radius-md);
    margin-bottom: 20px;
}

/* ============================================================
   响应式
   ============================================================ */
@media (max-width: 768px) {
    .alphabet-grid {
        grid-template-columns: repeat(6, 1fr);
        gap: 6px;
        padding: 10px;
    }

    .letter-tile {
        font-size: 24px;
    }

    .letter-tile .tile-lower {
        font-size: 14px;
    }

    .letter-card {
        width: 200px;
        height: 240px;
    }

    .letter-upper {
        font-size: 120px;
    }

    .letter-lower {
        font-size: 60px;
    }

    .word-emoji {
        font-size: 36px;
    }

    .word-en {
        font-size: 18px;
    }

    .numbers-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .number-en-card {
        width: 200px;
        height: 200px;
    }

    .number-en-digit {
        font-size: 90px;
    }

    .number-en-word {
        font-size: 26px;
    }

    .match-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 6px;
    }

    .match-card-front {
        font-size: 24px;
    }

    .match-card-back {
        font-size: 28px;
    }

    .stat-pill {
        font-size: 14px;
        padding: 4px 10px;
    }
}

@media (max-width: 480px) {
    .alphabet-grid {
        grid-template-columns: repeat(5, 1fr);
    }

    .letter-tile {
        font-size: 20px;
    }

    .numbers-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .list-digit {
        font-size: 36px;
    }

    .match-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}
