:root {
    --primary-pink: #ff6b81;
    --secondary-pink: #ff4757;
    --bg-light: #f7f9fc;
    --card-bg: #ffffff;
    --text-main: #2f3542;
    --text-muted: #747d8c;
    --accent-green: #2ed573;
    --accent-blue: #1e90ff;
    --accent-yellow: #ffa502;
    --border-radius: 16px;
    --shadow-soft: 0 4px 15px rgba(0, 0, 0, 0.05);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-light);
    color: var(--text-main);
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
}

/* 侧边栏 */
.sidebar {
    width: 240px;
    background: #ffffff;
    border-right: 1px solid #ffeaa7;
    padding: 20px 15px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: 2px 0 10px rgba(0,0,0,0.03);
    z-index: 100;
    flex-shrink: 0;
}

.brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 5px 15px 5px;
    border-bottom: 2px dashed #f1f2f6;
}

.brand-title {
    font-size: 18px;
    font-weight: bold;
    color: var(--text-main);
}

.star-badge {
    background: #fef5e7;
    color: var(--accent-yellow);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: bold;
    border: 1px solid #ffeaa7;
}

.nav-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 12px;
    color: #57606f;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.nav-item:hover {
    background-color: #fff0f3;
    color: var(--primary-pink);
}

.nav-item.active {
    background-color: var(--primary-pink);
    color: white;
    box-shadow: 0 4px 12px rgba(255, 107, 129, 0.3);
}

.user-card {
    margin-top: auto;
    background: #f8efba;
    padding: 12px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 36px; height: 36px;
    background: white;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
}

.user-info { display: flex; flex-direction: column; }
.user-name { font-size: 13px; font-weight: bold; color: #2c2c54; }
.user-level { font-size: 11px; color: #7158e2; }

/* 主体内容 */
.main-content {
    flex: 1;
    padding: 20px;
    max-width: 860px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.top-banner {
    background: #ffffff;
    border: 2px dashed #ff7875;
    border-radius: 16px;
    padding: 10px 20px;
    text-align: center;
    color: #ff4d4f;
    font-size: 16px;
    font-weight: bold;
}

.card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--shadow-soft);
    display: flex;
    flex-direction: column;
    gap: 15px;
}

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

.card-title { font-size: 18px; font-weight: bold; }
.section-desc { font-size: 13px; color: var(--text-muted); }

/* 朗读控制 */
.tts-controls {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 13px;
    color: #57606f;
    flex-wrap: wrap;
}

.tts-controls input[type="range"] {
    width: 80px;
    accent-color: var(--primary-pink);
}

/* 按钮样式 */
.btn-refresh, .btn-submit, .btn-action, .btn-check, .btn-redeem, .btn-speak {
    border: none;
    cursor: pointer;
    font-weight: bold;
    border-radius: 20px;
    transition: transform 0.1s ease;
}

.btn-refresh:active, .btn-submit:active, .btn-action:active, .btn-check:active, .btn-redeem:active, .btn-speak:active {
    transform: scale(0.95);
}

.btn-refresh { background: #70a1ff; color: white; padding: 6px 14px; font-size: 13px; }
.btn-submit { background: #2ed573; color: white; padding: 0 20px; font-size: 15px; border-radius: 10px; }

/* 拼音/字母/单词网格 */
.pinyin-grid, .alphabet-grid, .word-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 12px;
}

.pinyin-card, .letter-card, .word-card {
    background: #ffffff;
    border: 2px solid #2ed573;
    border-radius: 14px;
    padding: 12px 8px;
    text-align: center;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    user-select: none;
}

.pinyin-card:hover, .letter-card:hover, .word-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.06);
}

.letter-card { border-color: #ffa502; background: #fffdf9; }
.word-card { border-color: #ff4757; background: #fff0f3; }

.pinyin-big, .letter-big { font-size: 30px; font-weight: 900; color: #2ed573; line-height: 1.1; }
.letter-big { color: #ff4757; }
.pinyin-word, .letter-word { font-size: 13px; font-weight: bold; color: #2f3542; margin-top: 4px; }
.letter-cn, .word-cn { font-size: 11px; color: #747d8c; }
.word-icon { font-size: 28px; }
.word-en { font-size: 14px; font-weight: bold; color: #ff4757; margin-top: 2px; }

/* 单词工具栏：搜索框 + 换一组 */
.word-tools {
    display: flex;
    gap: 10px;
    align-items: center;
}

.search-input {
    flex: 1;
    padding: 10px 16px;
    border-radius: 20px;
    border: 1px solid #dfe4ea;
    outline: none;
    font-size: 14px;
}
.search-input:focus { border-color: var(--primary-pink); }

.word-tools .btn-refresh {
    padding: 10px 16px;
    font-size: 13px;
    white-space: nowrap;
}

/* 计时器与算术 */
.timer-display { font-size: 52px; font-weight: bold; color: var(--primary-pink); text-align: center; }
.timer-actions { display: flex; justify-content: center; gap: 12px; }
.btn-action { padding: 8px 20px; color: white; font-size: 14px; }
.btn-start { background: #2ed573; }
.btn-pause { background: #ffa502; }
.btn-reset { background: #ff4757; }

.math-options { display: flex; gap: 15px; font-size: 14px; background: #f8f9fa; padding: 10px; border-radius: 10px; }
.math-question { font-size: 32px; font-weight: bold; text-align: center; margin: 10px 0; color: #2f3542; }
.math-input-group { display: flex; justify-content: center; gap: 10px; }
.math-input { width: 90px; height: 40px; border: 2px solid #dfe4ea; border-radius: 8px; font-size: 20px; text-align: center; outline: none; }
.math-feedback { text-align: center; font-weight: bold; font-size: 14px; min-height: 20px; margin-top: 6px; }
.mistake-list { display: flex; flex-direction: column; gap: 6px; }
.mistake-box { background: #ffeef0; border-left: 4px solid #ff4757; padding: 8px 12px; border-radius: 6px; font-size: 13px; color: #d63031; }

/* 打卡与奖励 */
.task-list { display: flex; flex-direction: column; gap: 8px; }
.task-item { display: flex; align-items: center; justify-content: space-between; background: #f8f9fa; padding: 10px 14px; border-radius: 10px; }
.btn-check { background: #2ed573; color: white; padding: 6px 14px; font-size: 12px; }
.btn-check.completed { background: #a4b0be; cursor: default; }

.reward-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.reward-card { background: #fff8ed; border: 1px solid #ffeaa7; border-radius: 14px; padding: 12px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.reward-icon { font-size: 32px; }
.reward-title { font-size: 13px; font-weight: bold; }
.reward-cost { font-size: 12px; color: #d63031; font-weight: bold; }
.btn-redeem { background: #ffa502; color: white; padding: 5px 12px; font-size: 12px; }

/* 古诗及诗意解读 */
.poem-card-body { background: #fff8ed; border-radius: 12px; padding: 16px; text-align: center; border: 1px solid #ffeaa7; display: flex; flex-direction: column; gap: 10px; }
.poem-title { font-size: 18px; font-weight: bold; }
.poem-author { font-size: 12px; color: #636e72; }
.poem-content { font-size: 16px; line-height: 1.8; font-family: "Kaiti", "STKaiti", serif; }

.poem-explain-box {
    background: #ffffff;
    border: 1px dashed #ffa502;
    border-radius: 10px;
    padding: 12px;
    text-align: left;
    font-size: 13px;
    color: #57606f;
    line-height: 1.6;
}
.poem-explain-title { font-weight: bold; color: #ff9f43; margin-bottom: 4px; }

.poem-btn-group { display: flex; justify-content: center; gap: 10px; }
.btn-speak { background: #2ed573; color: white; padding: 8px 16px; font-size: 13px; }
.btn-explain-speak { background: #1e90ff; }

/* 📱 移动端适配：导航栏重构为两排 (4x2) */
@media (max-width: 768px) {
    body { flex-direction: column; }
    .sidebar { 
        width: 100%; 
        border-right: none; 
        border-bottom: 1px solid #ffeaa7; 
        padding: 10px; 
        position: sticky; 
        top: 0; 
        background: #fff; 
    }
    .user-card { display: none; }
    
    /* 两排导航按钮布局 */
    .nav-list { 
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 6px;
        white-space: normal;
    }
    
    .nav-item { 
        padding: 6px 2px; 
        font-size: 11px; 
        flex-direction: column;
        justify-content: center;
        text-align: center;
        gap: 3px;
    }

    .main-content { padding: 12px; }
    .pinyin-grid, .alphabet-grid, .word-card-grid { grid-template-columns: repeat(auto-fill, minmax(85px, 1fr)); }
}
