/* 语文森林 - 竹简阶梯独立入口样式 */

.chinese-forest {
    position: relative;
    min-height: 100vh;
    padding: 16px;
    background: linear-gradient(180deg, #E8F5E9 0%, #C8E6C9 50%, #A5D6A7 100%);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.chinese-forest-bg {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    background:
        radial-gradient(ellipse 80% 40% at 50% 100%, rgba(76, 175, 80, 0.15) 0%, transparent 70%),
        radial-gradient(ellipse 60% 30% at 20% 90%, rgba(129, 199, 132, 0.2) 0%, transparent 60%),
        radial-gradient(ellipse 60% 30% at 80% 90%, rgba(129, 199, 132, 0.2) 0%, transparent 60%);
    z-index: 0;
}

.chinese-forest-header {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: flex-start; gap: 8px;
    padding: 8px 16px; margin-bottom: 8px;
}

.chinese-forest-back {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    font-size: 18px;
    color: #2E7D32;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.chinese-forest-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 20px;
    font-weight: 700;
    color: #1B5E20;
}

.chinese-forest-icon {
    font-size: 26px;
}

.chinese-forest-wubao {
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(255, 255, 255, 0.8);
    padding: 4px 10px;
    border-radius: 16px;
    font-size: 13px;
    color: #2E7D32;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.wubao-icon {
    font-size: 16px;
}

.chinese-forest-subtitle {
    position: relative;
    z-index: 1;
    text-align: center;
    font-size: 14px;
    color: #558B2F;
    margin-bottom: 20px;
    letter-spacing: 2px;
}

.chinese-forest-tree {
    position: relative;
    z-index: 1;
    max-width: 420px;
    margin: 0 auto;
    padding-bottom: 40px;
}

.chinese-forest-tree::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 6px;
    background: linear-gradient(180deg, #8D6E63 0%, #6D4C41 100%);
    border-radius: 3px;
    transform: translateX(-50%);
    opacity: 0.3;
}

.chinese-forest-levels {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chinese-forest-level {
    position: relative;
    width: 70%;
    margin: 0 auto;
    min-height: 110px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    overflow: hidden;
}

.chinese-forest-level:nth-child(odd) {
    margin-left: 5%;
}

.chinese-forest-level:nth-child(even) {
    margin-right: 5%;
}

.chinese-forest-level:active {
    transform: scale(0.98);
}

.bamboo-top,
.bamboo-bottom {
    position: absolute;
    left: 0;
    right: 0;
    height: 8px;
    background: rgba(0, 0, 0, 0.08);
    border-radius: 50%;
}

.bamboo-top {
    top: 4px;
}

.bamboo-bottom {
    bottom: 4px;
}

.level-lock {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 28px;
    opacity: 0.5;
}

.level-content {
    position: relative;
    padding: 14px 16px;
    text-align: center;
    color: #1B5E20;
}

.level-number {
    font-size: 12px;
    font-weight: 700;
    opacity: 0.7;
    margin-bottom: 2px;
}

.level-name {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 2px;
    letter-spacing: 1px;
}

.level-grade {
    font-size: 12px;
    opacity: 0.8;
    margin-bottom: 6px;
}

.level-stars {
    font-size: 14px;
    margin-bottom: 6px;
}

.level-stars .star {
    margin: 0 2px;
}

.level-progress-bar {
    width: 80%;
    height: 4px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 2px;
    margin: 0 auto;
    overflow: hidden;
}

.level-progress-fill {
    height: 100%;
    background: #1B5E20;
    border-radius: 2px;
    transition: width 0.3s ease;
}

/* 状态样式 */
.chinese-forest-level.level-locked {
    filter: grayscale(0.6);
    opacity: 0.7;
}

.chinese-forest-level.level-completed {
    box-shadow: 0 4px 16px rgba(76, 175, 80, 0.3);
}

.chinese-forest-level.level-completed .level-content {
    color: #1B5E20;
}

.chinese-forest-level.level-current {
    box-shadow: 0 0 0 3px rgba(255, 215, 0, 0.6), 0 4px 12px rgba(0, 0, 0, 0.1);
    animation: bamboo-glow 2s ease-in-out infinite;
}

@keyframes bamboo-glow {
    0%, 100% { box-shadow: 0 0 0 3px rgba(255, 215, 0, 0.4), 0 4px 12px rgba(0, 0, 0, 0.1); }
    50% { box-shadow: 0 0 0 5px rgba(255, 215, 0, 0.6), 0 4px 16px rgba(0, 0, 0, 0.12); }
}

/* 小屏幕适配 */
@media (max-width: 360px) {
    .chinese-forest-level {
        width: 80%;
        min-height: 100px;
    }

    .level-name {
        font-size: 16px;
    }
}

.chinese-forest-header .cf-icon { font-size: 28px; }
.chinese-forest-header .cf-name { font-size: 20px; font-weight: 700; color: #2e7d32; }
.chinese-forest-header .cf-wubao { margin-left: auto; font-size: 14px; font-weight: 600; color: #2e7d32; }

/* ==================== 语文答题页（田字格 + 四线三格 + 组词 + 造句） ==================== */

.chinese-question-area {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
}

.chinese-question-card {
    width: 100%;
    max-width: 480px;
    background: #fffdf7;
    border-radius: 16px;
    padding: 22px 16px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.06);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

/* 田字格/米字格（汉字）：外框 + 十字虚线 + 对角线虚线 = 米字格 */
.tianzige-box {
    width: 132px;
    height: 132px;
    position: relative;
    border: 2px solid #d4a0a0;
    background-color: #fff;
    background-image:
        linear-gradient(to top right, transparent calc(50% - 0.5px), #ecc4c4 50%, transparent calc(50% + 0.5px)),
        linear-gradient(to bottom right, transparent calc(50% - 0.5px), #ecc4c4 50%, transparent calc(50% + 0.5px));
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.tianzige-box::before {
    content: '';
    position: absolute;
    left: 0; right: 0;
    top: 50%;
    border-top: 1px dashed #e0b0b0;
}
.tianzige-box::after {
    content: '';
    position: absolute;
    top: 0; bottom: 0;
    left: 50%;
    border-left: 1px dashed #e0b0b0;
}
.tianzige-text {
    font-size: 76px;
    font-family: 'STKaiti', 'KaiTi', 'Kaiti SC', serif;
    color: #333;
    line-height: 1;
    z-index: 1;
}
.tianzige-text.answered {
    color: #228B22;
}
.tianzige-blank {
    font-size: 22px;
    color: #bbb;
    z-index: 1;
}

/* 四线三格（拼音） */
.pinyin-grid-box {
    width: 190px;
    height: 62px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-top: 2px solid #e06060;
    border-bottom: 2px solid #e06060;
    background:
        linear-gradient(to bottom, transparent 0, transparent calc(33.333% - 0.5px), #e06060 33.333%, transparent calc(33.333% + 0.5px), transparent calc(66.666% - 0.5px), #e06060 66.666%, transparent calc(66.666% + 0.5px));
}
.pinyin-grid-text {
    font-size: 34px;
    font-weight: 700;
    color: #c0392b;
    letter-spacing: 1px;
    z-index: 1;
    line-height: 1;
}
.pinyin-grid-text.answered {
    color: #228B22;
}
.pinyin-grid-blank {
    font-size: 22px;
    color: #bbb;
    z-index: 1;
}

/* 组词行 */
.chinese-word-line {
    font-size: 22px;
    font-weight: 600;
    color: #333;
    letter-spacing: 2px;
    text-align: center;
}
.word-blank-box {
    display: inline-block;
    min-width: 34px;
    text-align: center;
    border-bottom: 2px solid #b0b0b0;
    margin: 0 4px;
    color: #228B22;
    font-weight: 700;
}
.word-blank-box.filled {
    border-bottom-color: #228B22;
}
.word-full { color: #333; }

/* 造句行 */
.chinese-sentence-line {
    font-size: 20px;
    color: #555;
    letter-spacing: 1px;
    line-height: 1.7;
    text-align: center;
}
.sentence-word {
    color: #f59e0b;
    font-weight: 700;
}
.sentence-blank {
    display: inline-block;
    min-width: 34px;
    text-align: center;
    border-bottom: 2px solid #f59e0b;
    margin: 0 2px;
    color: #f59e0b;
    font-weight: 700;
}
.sentence-blank.filled { color: #f59e0b; }

/* 选项区（小，横向4格） */
.chinese-options {
    display: flex;
    gap: 8px;
    padding: 10px 12px 6px;
    justify-content: center;
}
.chinese-option {
    flex: 1;
    min-width: 64px;
    max-width: 96px;
    border: 2px solid #e2e8f0;
    border-radius: 14px;
    padding: 10px 4px 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    background: #fff;
    transition: all 0.15s;
    position: relative;
}
.chinese-option:active { transform: scale(0.96); }
.opt-label {
    position: absolute;
    top: 4px;
    left: 6px;
    font-size: 11px;
    font-weight: 700;
    color: #aaa;
    line-height: 1;
}
.chinese-option.selected .opt-label { color: #228B22; }
.chinese-option.correct .opt-label { color: #38a169; }
.chinese-option.wrong .opt-label { color: #e53e3e; }
.chinese-option.selected {
    border-color: #228B22;
    background: #f0fff0;
}
.chinese-option.correct {
    border-color: #38a169;
    background: #f0fff4;
    box-shadow: 0 0 0 3px rgba(56, 161, 105, 0.3);
}
.chinese-option.wrong {
    border-color: #e53e3e;
    background: #fff5f5;
}
.opt-pinyin {
    font-size: 17px;
    color: #2e7d32;
    font-weight: 600;
    line-height: 1.1;
}
.opt-char {
    font-size: 30px;
    font-family: 'STKaiti', 'KaiTi', 'Kaiti SC', serif;
    color: #333;
    line-height: 1.2;
}
.opt-word {
    font-size: 11px;
    color: #999;
    line-height: 1.1;
}
.opt-pinyin-only {
    font-size: 21px;
    color: #2e7d32;
    font-weight: 600;
    padding: 10px 0;
}

/* 字形/词语题常规题干 */
.chinese-plain-question {
    font-size: 24px;
    font-weight: 600;
    color: #333;
    line-height: 1.6;
    text-align: center;
    padding: 10px 4px;
}

/* 字形/词语题选项文本 */
.opt-text {
    font-size: 18px;
    color: #333;
    padding: 10px 0;
    line-height: 1.4;
}

/* 内容题题干（古诗上下句填空/课文理解/文言文） */
.content-question-text {
    font-size: 21px;
    font-weight: 600;
    color: #333;
    text-align: center;
    line-height: 1.7;
    padding: 6px 0;
}

/* ==================== 注音单元（拼音上 + 米字格下） ==================== */
.chinese-word-line,
.chinese-sentence-line {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-end;
    gap: 6px;
}
.zhuyin-unit {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}
.unit-pinyin {
    font-size: 14px;
    color: #c0392b;
    font-weight: 600;
    line-height: 1;
    min-height: 16px;
    letter-spacing: 0;
}
.unit-pinyin.blank { color: #bbb; }
.unit-pinyin.answered { color: #228B22; }
.mini-mizige {
    width: 44px;
    height: 44px;
    position: relative;
    border: 1.5px solid #d4a0a0;
    background-color: #fff;
    background-image:
        linear-gradient(to top right, transparent calc(50% - 0.5px), #ecc4c4 50%, transparent calc(50% + 0.5px)),
        linear-gradient(to bottom right, transparent calc(50% - 0.5px), #ecc4c4 50%, transparent calc(50% + 0.5px));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-family: 'STKaiti', 'KaiTi', 'Kaiti SC', serif;
    color: #333;
    line-height: 1;
}
.mini-mizige::before {
    content: '';
    position: absolute;
    left: 0; right: 0; top: 50%;
    border-top: 1px dashed #e0b0b0;
}
.mini-mizige::after {
    content: '';
    position: absolute;
    top: 0; bottom: 0; left: 50%;
    border-left: 1px dashed #e0b0b0;
}
.mini-mizige .blank { color: #ccc; }
.mini-mizige .answered { color: #228B22; }

/* 选项里的迷你注音（字形/词语题选项带拼音） */
.opt-zhuyin {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
}
.opt-zhuyin .opt-py {
    font-size: 12px;
    color: #2e7d32;
    line-height: 1;
}
.opt-zhuyin .opt-hz {
    font-size: 24px;
    font-family: 'STKaiti', 'KaiTi', 'Kaiti SC', serif;
    color: #333;
    line-height: 1.2;
}

/* 词语题题干（目标词注音） */
.chinese-word-question {
    font-size: 22px;
    font-weight: 600;
    color: #333;
    text-align: center;
    padding: 10px 4px;
    line-height: 1.6;
}
.word-zhuyin {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    vertical-align: middle;
}
.wq-py {
    font-size: 14px;
    color: #c0392b;
    line-height: 1;
    letter-spacing: 1px;
}
.wq-hz {
    font-size: 30px;
    font-family: 'STKaiti', 'KaiTi', 'Kaiti SC', serif;
    color: #333;
    line-height: 1.2;
}
.wq-suffix {
    margin-left: 6px;
}

/* ==================== 组词大格子（四线三格拼音 + 大米字格） ==================== */
.word-unit {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}
.word-pinyin-grid {
    height: 54px;
    min-width: 118px;
    padding: 0 10px;
    border-top: 3px solid #4CAF50;
    border-bottom: 3px solid #4CAF50;
    background-image: linear-gradient(
        to bottom,
        transparent 0,
        transparent calc(33.333% - 0.5px),
        #4CAF50 calc(33.333% - 0.5px),
        #4CAF50 calc(33.333% + 0.5px),
        transparent calc(33.333% + 0.5px),
        transparent calc(66.666% - 0.5px),
        #4CAF50 calc(66.666% - 0.5px),
        #4CAF50 calc(66.666% + 0.5px),
        transparent calc(66.666% + 0.5px),
        transparent 100%
    );
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: 700;
    color: #2e7d32;
    letter-spacing: 1px;
    line-height: 1;
}
.word-pinyin-grid.blank { color: #ccc; }
.word-pinyin-grid.answered { color: #ef4444; }
.word-mizige {
    width: 120px;
    height: 120px;
    position: relative;
    border: 2px solid #4CAF50;
    background-color: #fff;
    background-image:
        linear-gradient(to top right, transparent calc(50% - 0.5px), #a5d6a7 50%, transparent calc(50% + 0.5px)),
        linear-gradient(to bottom right, transparent calc(50% - 0.5px), #a5d6a7 50%, transparent calc(50% + 0.5px));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 82px;
    font-family: 'STKaiti', 'KaiTi', 'Kaiti SC', serif;
    color: #333;
    line-height: 1;
}
.word-mizige::before {
    content: '';
    position: absolute;
    left: 0; right: 0; top: 50%;
    border-top: 1px dashed #a5d6a7;
}
.word-mizige::after {
    content: '';
    position: absolute;
    top: 0; bottom: 0; left: 50%;
    border-left: 1px dashed #a5d6a7;
}
.word-mizige .answered { color: #ef4444; }

/* 组词按字数缩放：2字大、3字中、4字小，保持一行 */
.chinese-word-line.word-count-3 .word-mizige { width: 92px; height: 92px; font-size: 62px; }
.chinese-word-line.word-count-4 .word-mizige { width: 72px; height: 72px; font-size: 48px; }
.chinese-word-line.word-count-3 .word-pinyin-grid { min-width: 90px; height: 44px; font-size: 24px; }
.chinese-word-line.word-count-4 .word-pinyin-grid { min-width: 70px; height: 36px; font-size: 20px; }

/* ==================== 造句普通注音（无格子） ==================== */
.sentence-unit {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
}
.sentence-pinyin {
    font-size: 12px;
    color: #2e7d32;
    line-height: 1;
    min-height: 14px;
    letter-spacing: 0;
}
.sentence-pinyin.blank { color: #bbb; }
.sentence-pinyin.answered { color: #ef4444; }
.sentence-char {
    font-size: 20px;
    color: #333;
    line-height: 1.2;
    font-weight: 500;
}
.sentence-char .answered { color: #ef4444; font-weight: 700; }

/* 字形题题干（逐字注音，拼音上字下） */
.shape-question {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-end;
    gap: 4px;
    padding: 12px 6px;
}
.shape-question .sentence-pinyin { font-size: 13px; }
.shape-question .sentence-char { font-size: 22px; font-weight: 600; }

/* 拼音声调规范渲染（声调上格、字母中格，用于四线三格） */
.py-text {
    display: inline-block;
    line-height: 1;
    transform: translateY(-3px);
}

/* 造句句号 */
.sentence-punct {
    font-size: 20px;
    color: #333;
    line-height: 1.2;
    align-self: flex-end;
}

/* 选项竖排（字形/词语题） */
.chinese-options.vertical {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
}
.chinese-options.vertical .chinese-option {
    max-width: none;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
}
.chinese-options.vertical .opt-label {
    position: static;
    font-size: 15px;
    color: #888;
    margin-right: 4px;
    flex-shrink: 0;
}
.chinese-options.vertical .opt-zhuyin {
    flex-direction: column;
    align-items: flex-start;
    flex: 1;
}
.chinese-options.vertical .opt-py {
    font-size: 13px;
}
.chinese-options.vertical .opt-hz {
    font-size: 22px;
}

/* 拼音静态显示容器（已废除 tegaki，改用纯文本 .py-text） */

/* 描红容器（hanzi-writer / tegaki SVG 渲染在这里，Vue 不管理内容） */
.stroke-container {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.stroke-container svg {
    display: block;
}
/* tegaki 拼音描红图层已废除 */

/* 选项逐字注音单元（拼音上、字下，逐字对齐） */
.opt-zhuyin-units {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 2px;
    flex: 1;
}
.opt-unit {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
}
.opt-unit-py {
    font-size: 12px;
    color: #2e7d32;
    line-height: 1;
    min-height: 13px;
}
.opt-unit-hz {
    font-size: 22px;
    font-family: 'STKaiti', 'KaiTi', 'Kaiti SC', serif;
    color: #333;
    line-height: 1.2;
}
.opt-unit-punct {
    font-size: 22px;
    color: #333;
    line-height: 1.2;
    align-self: flex-end;
}
.opt-zhuyin-units.red .opt-unit-py { color: #ef4444; }
.opt-zhuyin-units.red .opt-unit-hz { color: #ef4444; }
