/* ===== 全局 ===== */
:root {
    --primary: #7c3aed;
    --primary-light: #a78bfa;
    --primary-dark: #6d28d9;
    --success: #059669;
    --danger: #e11d48;
    --warning: #f59e0b;
    --bg-start: #ff6b6b;
    --bg-mid: #7c3aed;
    --bg-end: #3b82f6;
    --card-bg: rgba(255,255,255,0.95);
    --card-bg2: #f8f7ff;
    --text: #1e1b4b;
    --text-light: #6b7280;
    --border: #e5e7eb;
    --shadow: 0 8px 32px rgba(124,58,237,0.15);
    --shadow-lg: 0 20px 60px rgba(124,58,237,0.2);
    --radius: 24px;
    --radius-sm: 14px;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
*{margin:0;padding:0;box-sizing:border-box}
body{
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #ff6b6b 0%, #c084fc 25%, #818cf8 50%, #38bdf8 75%, #34d399 100%);
    background-attachment: fixed;
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
}
/* 背景浮动装饰 */
body::before{
    content: '';
    position: fixed;
    top: -100px; left: -100px;
    width: 300px; height: 300px;
    background: radial-gradient(circle, rgba(255,255,255,0.25) 0%, transparent 70%);
    border-radius: 50%;
    animation: float1 8s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
}
body::after{
    content: '';
    position: fixed;
    bottom: -80px; right: -80px;
    width: 400px; height: 400px;
    background: radial-gradient(circle, rgba(255,255,255,0.2) 0%, transparent 70%);
    border-radius: 50%;
    animation: float2 10s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
}
@keyframes float1{
    0%,100%{transform:translate(0,0) scale(1)}
    33%{transform:translate(60px,-40px) scale(1.1)}
    66%{transform:translate(-20px,30px) scale(0.95)}
}
@keyframes float2{
    0%,100%{transform:translate(0,0) scale(1)}
    33%{transform:translate(-50px,-30px) scale(1.15)}
    66%{transform:translate(30px,20px) scale(0.9)}
}

/* ===== 登录弹窗 ===== */
.overlay{
    position:fixed;top:0;left:0;right:0;bottom:0;
    background: linear-gradient(135deg, #ff6b6b, #c084fc, #818cf8, #38bdf8, #34d399);
    display:flex;align-items:center;justify-content:center;
    z-index:1000;
}
.auth-card{
    background: rgba(255,255,255,0.97);
    border-radius: 28px;
    padding: 44px 40px;
    width: 400px;
    max-width: 90vw;
    box-shadow: 0 25px 80px rgba(124,58,237,0.25);
    animation: cardIn 0.6s ease;
    position: relative;
    overflow: hidden;
}
.auth-card::before{
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg, #ff6b6b, #c084fc, #818cf8, #38bdf8, #34d399);
    background-size: 200% 100%;
    animation: barShine 3s ease infinite;
}
@keyframes barShine{
    0%,100%{background-position:0% 50%}
    50%{background-position:100% 50%}
}
.auth-logo{
    text-align: center;
    font-size: 26px;
    font-weight: 800;
    background: linear-gradient(135deg, #7c3aed, #3b82f6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 28px;
}
.auth-card h3{
    text-align: center;
    font-size: 20px;
    margin-bottom: 20px;
    color: var(--text);
}
.auth-card input{
    width: 100%;
    padding: 14px 18px;
    margin-bottom: 14px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 16px;
    background: #f9fafb;
    color: var(--text);
    outline: none;
    transition: var(--transition);
}
.auth-card input:focus{
    border-color: #7c3aed;
    box-shadow: 0 0 0 4px rgba(124,58,237,0.1);
    background: #fff;
}
.auth-switch{
    text-align: center;
    margin-top: 16px;
    color: var(--text-light);
    font-size: 14px;
}
.auth-switch a{ color: #7c3aed; text-decoration: none; font-weight: 600; }
.auth-hint{
    text-align: center;
    color: var(--text-light);
    font-size: 13px;
    margin-top: 10px;
}
.btn-primary{
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 14px;
    background: linear-gradient(135deg, #7c3aed, #3b82f6);
    color: white;
    font-size: 17px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    margin-top: 6px;
    box-shadow: 0 8px 25px rgba(124,58,237,0.3);
}
.btn-primary:hover{
    transform: translateY(-3px);
    box-shadow: 0 12px 35px rgba(124,58,237,0.4);
}
.btn-primary:active{ transform: translateY(-1px); }

/* ===== App容器 ===== */
.app-container{
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    position: relative;
    z-index: 1;
}

/* ===== 顶部栏 ===== */
.topbar{
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 28px;
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255,255,255,0.3);
    z-index: 100;
    flex-shrink: 0;
    box-shadow: 0 2px 20px rgba(124,58,237,0.08);
}
.topbar-left{ display:flex; align-items:center; gap:10px; }
.logo-icon{ font-size: 26px; animation: logoBounce 2s ease-in-out infinite; }
@keyframes logoBounce{
    0%,100%{transform:translateY(0)}
    50%{transform:translateY(-4px)}
}
.logo-text{
    font-size: 20px;
    font-weight: 800;
    background: linear-gradient(135deg, #7c3aed, #3b82f6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.wordset-select{
    padding: 4px 8px;
    border: 1px solid rgba(124,58,237,0.3);
    border-radius: 8px;
    background: rgba(255,255,255,0.9);
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    outline: none;
    transition: all 0.25s ease;
}
.wordset-select:hover{
    border-color: var(--primary);
    background: #faf5ff;
}
.wordset-select:focus{
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(124,58,237,0.1);
}
.topbar-center{ font-size: 15px; color: var(--text-light); font-weight: 600; }
.topbar-right{ display:flex; align-items:center; gap:14px; }
.user-badge{ font-size: 14px; color: var(--text); font-weight: 600; }
.badge{ padding: 5px 14px; border-radius: 20px; font-size: 13px; font-weight: 700; }
.score-badge{ background: linear-gradient(135deg, #fef3c7, #fde68a); color: #92400e; }
.streak-badge{ background: linear-gradient(135deg, #fce7f3, #fbcfe8); color: #9d174d; }
.btn-icon{
    background: none; border: none;
    font-size: 20px; cursor: pointer;
    padding: 6px 10px; border-radius: 10px;
    transition: var(--transition);
}
.btn-icon:hover{ background: #f3f4f6; transform: scale(1.1); }

/* ===== View容器 ===== */
.view-container{
    flex: 1;
    display: flex;
    align-items: stretch;
    justify-content: center;
    overflow: hidden;
    padding: 16px;
}
.view{ width: 100%; max-width: 820px; }
#view-quiz .view{ max-width: 100%; }
.view:not(.active){ display: none; }
.view.active{ display: block; animation: viewIn 0.4s ease; }
@keyframes viewIn{
    from{opacity:0;transform:translateY(15px)}
    to{opacity:1;transform:translateY(0)}
}

/* ===== PPT卡片通用 ===== */
.ppt-card{
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 24px 28px;
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(255,255,255,0.5);
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
}
.ppt-card::before{
    content: none;
}
.ppt-card h2{
    font-size: 20px;
    margin-bottom: 10px;
    color: var(--text);
    text-align: center;
    font-weight: 800;
}

/* ===== 首页模式选择 ===== */
.home-card{ text-align: center; display: flex; flex-direction: column; height: 100%; max-height: calc(100vh - 140px); }
.home-card > * { flex-shrink: 0; }
.home-card .lesson-grid{ flex: 1; min-height: 0; overflow-y: auto; }
#lessonGridWrap{ flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; }
/* ===== 题型选择（横排小按钮）===== */
.mode-row{
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 12px;
}
.mode-btn{
    padding: 8px 20px;
    border: 2px solid #e5e7eb;
    border-radius: 25px;
    background: linear-gradient(135deg, #faf5ff, #f0f9ff);
    color: var(--text);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}
.mode-btn:hover{
    border-color: #a78bfa;
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(124,58,237,0.12);
}
.mode-btn.active{
    border-color: #7c3aed;
    background: linear-gradient(135deg, #7c3aed, #3b82f6);
    color: white;
    box-shadow: 0 6px 20px rgba(124,58,237,0.35);
}

/* ===== 课程网格 ===== */
.lesson-grid{
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 5px;
    margin-bottom: 12px;
    padding: 4px;
}
.lesson-btn{
padding: 6px 2px;
background: linear-gradient(135deg, #faf5ff, #f0f9ff);
border: 2px solid #e5e7eb;
border-radius: 8px;
color: var(--text);
font-size: 12px;
cursor: pointer;
transition: all 0.25s ease;
text-align: center;
font-weight: 700;
display: flex;
flex-direction: column;
align-items: center;
gap: 1px;
}
.lesson-btn .lesson-progress{
font-size: 9px;
font-weight: 600;
color: var(--text-light);
line-height: 1;
}
.lesson-btn:hover{
    border-color: #7c3aed;
    background: linear-gradient(135deg, #ede9fe, #dbeafe);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(124,58,237,0.15);
}
.lesson-btn.has-err{
    border-color: #fca5a5;
    background: linear-gradient(135deg, #fef2f2, #fff1f2);
}
.lesson-btn.has-err::after{
content: none;
}
.lesson-btn.all-done{
border-color: #86efac;
background: linear-gradient(135deg, #ecfdf5, #f0fdf4);
}
.lesson-btn.all-done .lesson-progress{
color: #16a34a;
}
/* ===== 首页Tab切换 ===== */
.home-tabs{
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 10px;
}
.home-tab{
    padding: 6px 20px;
    border: 2px solid #e5e7eb;
    border-radius: 20px;
    background: rgba(255,255,255,0.8);
    color: var(--text-light);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
}
.home-tab:hover{
    border-color: var(--primary-light);
    color: var(--primary);
}
.home-tab.active{
    border-color: var(--primary);
    background: linear-gradient(135deg, #ede9fe, #ddd6fe);
    color: var(--primary-dark);
}

/* ===== 分类网格 ===== */
.category-grid{
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 8px;
    margin-bottom: 12px;
    padding: 4px;
}
#categoryGridWrap{ flex: 1; min-height: 0; overflow-y: auto; }
.category-btn{
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 10px 6px;
    border: 2px solid #e5e7eb;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, #faf5ff, #f0f9ff);
    color: var(--text);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.25s ease;
    text-align: center;
}
.category-btn:hover{
    border-color: var(--primary);
    background: linear-gradient(135deg, #ede9fe, #dbeafe);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(124,58,237,0.15);
}
.category-btn .category-name{
    font-weight: 700;
    font-size: 13px;
}
.category-btn .category-count{
font-size: 11px;
color: var(--text-light);
background: #f3f4f6;
padding: 1px 8px;
border-radius: 10px;
margin-top: 2px;
}
.category-btn.all-done{
border-color: #86efac;
background: linear-gradient(135deg, #ecfdf5, #f0fdf4);
}
.category-btn.all-done .category-count{
color: #16a34a;
background: #dcfce7;
}

.btn-start{
    padding: 8px 32px;
    border: none;
    border-radius: 30px;
    background: linear-gradient(135deg, #ff6b6b, #c084fc, #3b82f6);
    background-size: 200% 200%;
    animation: btnGlow 3s ease infinite;
    color: white;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.35s ease;
    box-shadow: 0 6px 24px rgba(124,58,237,0.3);
    letter-spacing: 1px;
}
@keyframes btnGlow{
    0%,100%{background-position:0% 50%}
    50%{background-position:100% 50%}
}
.btn-start:hover{
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 14px 45px rgba(124,58,237,0.45);
}
.btn-start:active{ transform: translateY(-2px) scale(0.98); }

/* ===== 答题全屏区 ===== */
.quiz-fullscreen{
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    width: 100%;
}
.quiz-progress{
    width: 100%;
    margin-bottom: 14px;
    flex-shrink: 0;
}
.progress-track{
    height: 10px;
    background: rgba(255,255,255,0.5);
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 10px;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.08);
}
.progress-fill{
    height: 100%;
    background: linear-gradient(90deg, #ff6b6b, #c084fc, #3b82f6, #34d399);
    background-size: 300% 100%;
    animation: progressGlow 2s ease infinite;
    border-radius: 5px;
    transition: width 0.5s ease;
    width: 0%;
    box-shadow: 0 0 12px rgba(124,58,237,0.3);
}
@keyframes progressGlow{
    0%,100%{background-position:0% 50%}
    50%{background-position:100% 50%}
}
.progress-text{
    display: flex;
    justify-content: space-between;
    font-size: 15px;
    color: rgba(255,255,255,0.95);
    font-weight: 700;
    text-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.progress-combo{ color: #fbbf24; font-size: 18px; animation: comboGlow 0.6s ease; }
@keyframes comboGlow{
    0%{transform:scale(1)}
    50%{transform:scale(1.3);text-shadow:0 0 20px rgba(251,191,36,0.6)}
    100%{transform:scale(1)}
}
.progress-score{ font-size: 18px; color: #fde68a; }

/* 三栏布局 */
.quiz-columns{
    flex: 1;
    display: flex;
    align-items: stretch;
    width: 100%;
    gap: 0;
    position: relative;
}
.quiz-side{
    width: 180px;
    min-width: 120px;
    flex-shrink: 0;
    position: relative;
    overflow: visible;
    pointer-events: none;
    z-index: 10;
}
.quiz-side-left{ }
.quiz-side-right{ }
.quiz-center{
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-width: 0;
    position: relative;
    z-index: 1;
}

/* 题目卡片 */
.quiz-card{
    background: rgba(255,255,255,0.97);
    border-radius: 28px;
    padding: 36px 40px;
    box-shadow: 0 25px 70px rgba(124,58,237,0.2);
    text-align: center;
    width: 100%;
    max-width: 700px;
    animation: none;
    border: 2px solid rgba(255,255,255,0.6);
    position: relative;
    overflow: hidden;
}
.quiz-card::after{
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg, #ff6b6b, #c084fc, #818cf8, #38bdf8, #34d399);
    background-size: 200% 100%;
    animation: barShine 3s ease infinite;
}
@keyframes cardIn{
    0%{opacity:0;transform:scale(0.88) translateY(25px)}
    100%{opacity:1;transform:scale(1) translateY(0)}
}
.question-label{
    font-size: 15px;
    color: var(--text-light);
    margin-bottom: 16px;
    letter-spacing: 2px;
    font-weight: 600;
    text-transform: uppercase;
}
.question-main{
    font-size: 56px;
    font-weight: 900;
    background: linear-gradient(135deg, #7c3aed, #3b82f6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 12px;
    word-break: break-word;
    line-height: 1.2;
    animation: questionGlow 2s ease-in-out infinite;
}
@keyframes questionGlow{
    0%,100%{filter:brightness(1)}
    50%{filter:brightness(1.15)}
}
.question-sub{
    font-size: 17px;
    color: var(--text-light);
    margin-bottom: 28px;
}

/* 选项 */
.options-grid{
display: grid;
grid-template-columns: 1fr 1fr;
gap: 14px;
}

/* ===== 单词拼写模式 ===== */
.spell-area{
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    margin-top: 20px;
}
.spell-hint{
    font-size: 28px;
    font-weight: 800;
    color: var(--text-light);
    letter-spacing: 6px;
    font-family: 'Courier New', monospace;
    min-height: 36px;
}
.spell-input-row{
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    max-width: 500px;
}
.spell-input{
    flex: 1;
    padding: 14px 20px;
    border: 3px solid #e5e7eb;
    border-radius: var(--radius-sm);
    font-size: 22px;
    font-weight: 700;
    text-align: center;
    color: var(--text);
    background: #fff;
    outline: none;
    transition: border-color 0.25s ease, background 0.25s ease;
    font-family: 'Courier New', monospace;
}
.spell-input:focus{
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(124,58,237,0.1);
}
.spell-input:disabled{
    cursor: not-allowed;
}
.btn-spell-submit{
    padding: 10px 40px;
    border: none;
    border-radius: 30px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    font-size: 15px;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 4px 16px rgba(124,58,237,0.3);
}
.btn-spell-submit:hover{
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(124,58,237,0.4);
}
.btn-spell-submit:active{
    transform: translateY(0);
}
.btn-spell-submit:disabled{
    opacity: 0.5;
    cursor: not-allowed;
}

/* ===== 虚拟键盘 ===== */
.vkbd{
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
    max-width: 500px;
    margin-top: 4px;
}
.vkbd-row{
    display: flex;
    justify-content: center;
    gap: 5px;
}
.vkbd-key{
    min-width: 32px;
    height: 44px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
    -webkit-user-select: none;
    flex: 1;
    max-width: 48px;
}
.vkbd-key:hover{
    background: #f5f3ff;
    border-color: var(--primary);
}
.vkbd-key:active{
    transform: scale(0.92);
    background: var(--primary);
    color: #fff;
}
.vkbd-key:disabled{
    opacity: 0.4;
    cursor: not-allowed;
}
.vkbd-key-del{
    max-width: 72px;
    background: #f9fafb;
    font-size: 20px;
}
.option-btn{
    padding: 16px 20px;
    border: 3px solid #e5e7eb;
    border-radius: 16px;
    background: linear-gradient(135deg, #faf5ff, #f0f9ff);
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    color: var(--text);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    word-break: break-word;
    position: relative;
    overflow: hidden;
}
.option-btn::after{
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(124,58,237,0.06), rgba(59,130,246,0.06));
    opacity: 0;
    transition: opacity 0.3s;
}
.option-btn:hover{
    border-color: #a78bfa;
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(124,58,237,0.15);
}
.option-btn:hover::after{ opacity: 1; }
.option-btn:disabled{ pointer-events: none; }
.option-btn.correct{
    border-color: #34d399;
    background: linear-gradient(135deg, #ecfdf5, #d1fae5);
    color: #065f46;
    animation: popCorrect 0.5s ease;
    box-shadow: 0 0 25px rgba(16,185,129,0.3);
}
.option-btn.wrong{
    border-color: #f87171;
    background: linear-gradient(135deg, #fef2f2, #fee2e2);
    color: #991b1b;
    animation: shakeWrong 0.5s ease;
}
/* 完形填空选项：等宽/大写字母 */
.option-cloze{
    font-family: 'Courier New', 'Consolas', 'Monaco', monospace;
    font-size: 28px;
    font-weight: 800;
    letter-spacing: 4px;
    padding: 24px;
}
@keyframes popCorrect{
    0%,100%{transform:scale(1)}
    25%{transform:scale(1.06)}
    50%{transform:scale(0.96)}
    75%{transform:scale(1.03)}
}
@keyframes shakeWrong{
    0%,100%{transform:translateX(0)}
    15%{transform:translateX(-8px)}
    30%{transform:translateX(8px)}
    45%{transform:translateX(-6px)}
    60%{transform:translateX(6px)}
    75%{transform:translateX(-3px)}
    90%{transform:translateX(3px)}
}

/* ===== 侧边反馈动画 ===== */
.side-feedback{
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    pointer-events: none;
    animation: sideFeedbackIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    z-index: 10;
}
.side-feedback-icon{
    font-size: 56px;
    animation: sideIconBounce 0.8s ease;
    filter: drop-shadow(0 4px 12px rgba(0,0,0,0.15));
}
.side-feedback-text{
    font-size: 18px;
    font-weight: 800;
    padding: 6px 18px;
    border-radius: 20px;
    white-space: nowrap;
    animation: sideTextIn 0.5s 0.2s ease both;
}
.side-feedback-correct .side-feedback-text{
    background: linear-gradient(135deg, #d1fae5, #a7f3d0);
    color: #065f46;
    box-shadow: 0 4px 16px rgba(16,185,129,0.3);
}
.side-feedback-wrong .side-feedback-text{
    background: linear-gradient(135deg, #fee2e2, #fecaca);
    color: #991b1b;
    box-shadow: 0 4px 16px rgba(225,29,72,0.3);
}
@keyframes sideFeedbackIn{
    0%{opacity:0;transform:scale(0.3)}
    60%{opacity:1;transform:scale(1.1)}
    100%{opacity:1;transform:scale(1)}
}
@keyframes sideIconBounce{
    0%{transform:scale(0) rotate(-30deg)}
    50%{transform:scale(1.4) rotate(10deg)}
    70%{transform:scale(0.9) rotate(-5deg)}
    100%{transform:scale(1) rotate(0deg)}
}
@keyframes sideTextIn{
    from{opacity:0;transform:translateY(10px) scale(0.8)}
    to{opacity:1;transform:translateY(0) scale(1)}
}
/* 烟花粒子 */
.firework-particle{
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    pointer-events: none;
    animation: fireworkBurst 1s ease-out forwards;
}
@keyframes fireworkBurst{
    0%{opacity:1;transform:translate(0,0) scale(1)}
    100%{opacity:0;transform:var(--fw-dx) var(--fw-dy) scale(0)}
}
/* 烟花拖尾 */
.firework-trail{
    position: absolute;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    pointer-events: none;
    opacity: 0.6;
    animation: trailFade 0.5s ease-out forwards;
}
@keyframes trailFade{
    from{opacity:0.6;transform:scale(1)}
    to{opacity:0;transform:scale(0)}
}
.btn-next{
    padding: 14px 44px;
    border: none;
    border-radius: 30px;
    background: linear-gradient(135deg, #7c3aed, #3b82f6);
    color: white;
    font-size: 17px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 8px 25px rgba(124,58,237,0.35);
    letter-spacing: 1px;
}
.btn-next:hover{
    transform: translateY(-3px);
    box-shadow: 0 12px 35px rgba(124,58,237,0.5);
}

/* ===== 结果页 ===== */
.result-card{
    text-align: center;
    position: relative;
    overflow: hidden;
    background: rgba(255,255,255,0.97) !important;
}
.confetti-canvas{
    position: absolute;
    top:0;left:0;width:100%;height:100%;
    pointer-events:none;
    z-index: 2;
}
.result-content{ position: relative; z-index: 3; }
.result-trophy{
    font-size: 90px;
    animation: trophySpin 0.8s ease-out;
    display: inline-block;
}
@keyframes trophySpin{
    0%{transform:scale(0) rotate(-180deg);opacity:0}
    60%{transform:scale(1.2) rotate(10deg);opacity:1}
    100%{transform:scale(1) rotate(0deg);opacity:1}
}
.result-card h2{
    font-size: 30px;
    margin: 12px 0 24px;
    background: linear-gradient(135deg, #7c3aed, #3b82f6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.result-stats{
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 24px;
}
.result-stat{
    background: linear-gradient(135deg, #faf5ff, #f0f9ff);
    border-radius: 18px;
    padding: 20px 10px;
    border: 2px solid #e5e7eb;
    transition: var(--transition);
}
.result-stat:hover{ transform: translateY(-3px); box-shadow: var(--shadow); }
.result-stat-value{
    font-size: 36px;
    font-weight: 900;
    background: linear-gradient(135deg, #7c3aed, #3b82f6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: countUp 0.6s ease;
}
@keyframes countUp{
    from{opacity:0;transform:translateY(10px)}
    to{opacity:1;transform:translateY(0)}
}
.result-stat-label{ font-size: 13px; color: var(--text-light); margin-top: 6px; font-weight: 600; }
.result-grade{
    display: inline-block;
    padding: 10px 32px;
    border-radius: 25px;
    font-size: 18px;
    font-weight: 800;
    margin-bottom: 24px;
    animation: gradePop 0.6s 0.3s ease both;
}
@keyframes gradePop{
    from{opacity:0;transform:scale(0.5)}
    to{opacity:1;transform:scale(1)}
}
.grade-S{ background: linear-gradient(135deg,#fbbf24,#f59e0b); color:#78350f; box-shadow:0 0 30px rgba(245,158,11,0.4); }
.grade-A{ background: linear-gradient(135deg,#34d399,#059669); color:white; box-shadow:0 0 30px rgba(5,150,105,0.4); }
.grade-B{ background: linear-gradient(135deg,#60a5fa,#3b82f6); color:white; box-shadow:0 0 30px rgba(59,130,246,0.4); }
.grade-C{ background: linear-gradient(135deg,#f87171,#e11d48); color:white; }
.result-actions{ display:flex; gap:14px; justify-content:center; }
.btn-again, .btn-back{
    padding:14px 32px;
    border:none;
    border-radius:30px;
    font-size:16px;
    font-weight:700;
    cursor:pointer;
    transition:var(--transition);
}
.btn-again{
    background: linear-gradient(135deg, #7c3aed, #3b82f6);
    color:white;
    box-shadow: 0 8px 25px rgba(124,58,237,0.3);
}
.btn-again:hover{ transform:translateY(-3px); box-shadow: 0 12px 35px rgba(124,58,237,0.45); }
.btn-back{ background: #f3f4f6; color: var(--text); border: 2px solid #e5e7eb; }
.btn-back:hover{ background: #e5e7eb; transform:translateY(-2px); }

/* ===== 统计页 ===== */
.stats-card{ max-height: calc(100vh - 140px); overflow-y: auto; }
.stats-grid{
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 10px;
}
.stat-card{
    background: linear-gradient(135deg, #faf5ff, #f0f9ff);
    border-radius: 12px;
    padding: 8px 6px;
    text-align: center;
    border: 2px solid #e5e7eb;
    transition: var(--transition);
}
.stat-card:hover{ transform:translateY(-3px); box-shadow:var(--shadow); }
.stat-icon{ font-size: 20px; margin-bottom: 2px; }
.stat-num{ font-size: 22px; font-weight: 900; color: #7c3aed; }
.stat-lbl{ font-size: 10px; color: var(--text-light); margin-top: 1px; font-weight: 600; }
.mode-stats-section, .recent-section{
    background: linear-gradient(135deg, #faf5ff, #f0f9ff);
    border-radius: 12px;
    padding: 10px;
    margin-bottom: 8px;
    border: 2px solid #e5e7eb;
}
.mode-stats-section h3, .recent-section h3{ font-size: 13px; margin-bottom: 6px; font-weight: 700; }
.mode-stats-grid{ display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.mode-stat-card{ text-align: center; padding: 6px 4px; }
.rate-circle{
    width: 42px;height:42px;
    border-radius:50%;
    border:3px solid #e5e7eb;
    display:flex;align-items:center;justify-content:center;
    font-size:13px;font-weight:900;
    margin:0 auto 2px;
    transition: var(--transition);
}
.rate-circle:hover{ transform: scale(1.1); }
.recent-list{ max-height: 160px; overflow-y: auto; font-size: 13px; }
.recent-item{
    display: flex;
    justify-content: space-between;
    padding: 6px 12px;
    border-radius: 8px;
    margin-bottom: 4px;
    background: white;
    border: 1px solid #f3f4f6;
}
.recent-item .recent-mode{ font-weight: 700; }
.recent-item .recent-score{ color: #7c3aed; font-weight: 700; }
.recent-item .recent-date{ color: var(--text-light); font-size: 12px; }
.btn-danger{
    background: linear-gradient(135deg, #f87171, #e11d48);
    color: white;
    border: none;
    padding: 10px 22px;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 700;
    margin-top: 12px;
    transition: var(--transition);
    box-shadow: 0 4px 15px rgba(225,29,72,0.25);
}
.btn-danger:hover{ transform: translateY(-2px); box-shadow: 0 8px 25px rgba(225,29,72,0.35); }

/* ===== 错题本 ===== */
.errorbook-card{ 
    height: calc(100dvh - 120px); 
    overflow: hidden; 
    display: flex; 
    flex-direction: column; 
}
.errorbook-card > * { flex-shrink: 0; }
.errorbook-card .error-list { flex: 1; overflow-y: auto; min-height: 0; }
.errorbook-header{ display:flex; justify-content:space-between; align-items:center; margin-bottom:8px; }
.errorbook-header h2{ margin-bottom:0; text-align:left; }
.errorbook-actions{ display:flex; gap:10px; }
.btn-warning{
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: white;
    border:none; padding:8px 16px; border-radius:25px; font-size:13px;
    cursor:pointer; font-weight:700; transition:var(--transition);
    box-shadow: 0 4px 15px rgba(245,158,11,0.3);
}
.btn-warning:hover{ transform:translateY(-2px); box-shadow: 0 8px 25px rgba(245,158,11,0.4); }
.btn-danger-sm{
    background: linear-gradient(135deg, #f87171, #e11d48);
    color:white;
    border:none; padding:8px 16px; border-radius:25px; font-size:13px;
    cursor:pointer; font-weight:700; transition:var(--transition);
    box-shadow: 0 4px 15px rgba(225,29,72,0.25);
}
.btn-danger-sm:hover{ transform:translateY(-2px); }
.error-list{ overflow-y: auto; min-height: 0; }
.error-item{
    display:flex;align-items:center;justify-content:space-between;
    padding:10px 14px; border-radius:12px;
    margin-bottom:6px;
    background: linear-gradient(135deg, #fef2f2, #fff1f2);
    border: 2px solid #fecaca;
    transition:var(--transition);
    animation: errorIn 0.3s ease;
}
@keyframes errorIn{
    from{opacity:0;transform:translateX(-10px)}
    to{opacity:1;transform:translateX(0)}
}
.error-item:hover{ background: linear-gradient(135deg, #fee2e2, #fecaca); transform:translateX(4px); }
.error-word-info{ display:flex; align-items:center; gap:16px; flex:1; }
.error-word{ font-size: 19px; font-weight: 800; color: #991b1b; }
.error-chinese{ font-size: 15px; color: var(--text-light); }
.error-count-tag{
    background: linear-gradient(135deg, #e11d48, #be123c);
    color: white;
    padding: 4px 14px;
    border-radius: 14px;
    font-size: 13px;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(225,29,72,0.3);
}
/* ===== 错题本 Tab ===== */
.errorbook-tabs{
    display: flex;
    gap: 6px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}
.error-tab{
    padding: 6px 14px;
    font-size: 13px;
    border: 2px solid #e5e7eb;
    border-radius: 25px;
    background: linear-gradient(135deg, #faf5ff, #f0f9ff);
    color: var(--text);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}
.error-tab:hover{
    border-color: #a78bfa;
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(124,58,237,0.12);
}
.error-tab.active{
    border-color: #7c3aed;
    background: linear-gradient(135deg, #7c3aed, #3b82f6);
    color: white;
    box-shadow: 0 6px 20px rgba(124,58,237,0.35);
}
.error-tab.active .error-tab-count{
    background: rgba(255,255,255,0.3);
    color: white;
}
.error-tab-count{
    background: #f3f4f6;
    color: #7c3aed;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 800;
    min-width: 20px;
    text-align: center;
}
.error-mode-tag{
    background: linear-gradient(135deg, #ede9fe, #dbeafe);
    color: #5b21b6;
    padding: 3px 10px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
}
.empty-state{ text-align:center; padding:50px; }
.empty-icon{ font-size: 65px; margin-bottom: 16px; animation: bounce 1s ease infinite; }
@keyframes bounce{
    0%,100%{transform:translateY(0)}
    50%{transform:translateY(-12px)}
}
.empty-state p{ color: var(--text-light); font-size: 16px; }

/* ===== 底部导航 ===== */
.bottombar{
    display: flex;
    justify-content: center;
    gap: 24px;
    padding: 12px 20px 18px;
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(20px);
    border-top: 1px solid rgba(255,255,255,0.3);
    flex-shrink: 0;
    box-shadow: 0 -2px 20px rgba(124,58,237,0.06);
}
.nav-btn{
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    border: none;
    border-radius: 30px;
    background: transparent;
    color: var(--text-light);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}
.nav-btn:hover{ background: #f3f4f6; color: var(--text); transform: translateY(-2px); }
.nav-btn.active{
    background: linear-gradient(135deg, #7c3aed, #3b82f6);
    color: white;
    box-shadow: 0 6px 25px rgba(124,58,237,0.35);
}
.err-dot{
    display: none !important;
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #e11d48;
    animation: pulse 1.5s ease-in-out infinite;
}
@keyframes pulse{
    0%,100%{opacity:1;transform:scale(1)}
    50%{opacity:0.5;transform:scale(1.3)}
}

/* ===== Toast ===== */
.toast-container{
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.toast{
    background: rgba(255,255,255,0.97);
    padding: 14px 24px;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.12);
    font-weight: 700;
    font-size: 15px;
    animation: toastIn 0.4s ease, toastOut 0.4s ease 2.2s forwards;
    border-left: 4px solid;
}
.toast.success{ border-color: #34d399; color: #065f46; }
.toast.error{ border-color: #f87171; color: #991b1b; }
.toast.info{ border-color: #7c3aed; color: #5b21b6; }
@keyframes toastIn{
    from{transform:translateX(120%);opacity:0}
    to{transform:translateX(0);opacity:1}
}
@keyframes toastOut{
    from{transform:translateX(0);opacity:1}
    to{transform:translateX(120%);opacity:0}
}

/* ===== 粒子 ===== */
.particle{
    position: fixed;
    pointer-events: none;
    z-index: 1999;
    font-size: 28px;
    animation: particleUp 0.9s ease-out forwards;
}
@keyframes particleUp{
    0%{transform:translateY(0) scale(1) rotate(0deg);opacity:1}
    100%{transform:translateY(-150px) scale(0) rotate(180deg);opacity:0}
}

/* ===== 单词集管理页 ===== */
.wordsets-card{
    max-width: 800px;
    max-height: 85vh;
    overflow-y: auto;
}
.wordset-import-area{
    background: rgba(124,58,237,0.05);
    border: 1px solid rgba(124,58,237,0.15);
    border-radius: 14px;
    padding: 16px 20px;
    margin-bottom: 20px;
}
.wordset-import-area h3{
    margin-bottom: 12px;
    font-size: 15px;
    color: var(--text);
}
.wordset-import-form{
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}
.import-input{
    flex: 1;
    min-width: 160px;
    padding: 8px 14px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.25s ease;
}
.import-input:focus{
    border-color: var(--primary);
}
.btn-file-label{
    padding: 8px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    background: #fff;
    color: var(--text);
    display: inline-block;
}
.btn-file-label:hover{
    border-color: var(--primary);
    background: #faf5ff;
}
.btn-primary-sm{
    padding: 8px 24px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.25s ease;
}
.btn-primary-sm:hover{
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(124,58,237,0.3);
}
.btn-primary-sm:disabled{
    opacity: 0.5;
    cursor: not-allowed;
}
.import-preview{
    margin-top: 12px;
    padding: 10px 14px;
    background: #f9fafb;
    border-radius: 10px;
}
.import-preview p{
    font-size: 13px;
    color: var(--text);
    margin-bottom: 6px;
}
.preview-list{
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.preview-word{
    font-size: 12px;
    background: #fff;
    padding: 2px 8px;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
    color: var(--text-light);
}
.preview-more{
    font-size: 12px;
    color: var(--text-light);
    align-self: center;
}
.wordset-list-section{
    margin-bottom: 20px;
}
.wordset-list-section h3{
    font-size: 15px;
    margin-bottom: 10px;
}
.wordset-list{
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.wordset-manage-item{
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    background: linear-gradient(135deg, #faf5ff, #f0f9ff);
    transition: all 0.25s ease;
}
.wordset-manage-item:hover{
    border-color: var(--primary);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(124,58,237,0.1);
}
.wordset-manage-item.active{
    border-color: #86efac;
    background: linear-gradient(135deg, #ecfdf5, #f0fdf4);
}
.wordset-manage-info{
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.wordset-manage-name{
    font-size: 15px;
    font-weight: 800;
    color: var(--text);
}
.wordset-manage-count{
    font-size: 12px;
    color: var(--text-light);
}
.wordset-manage-actions{
    display: flex;
    gap: 6px;
}
.btn-sm{
    padding: 5px 14px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text);
}
.btn-sm:hover{
    border-color: var(--primary);
    background: #faf5ff;
}
.btn-sm-danger{
    color: #ef4444;
    border-color: #fecaca;
}
.btn-sm-danger:hover{
    border-color: #ef4444;
    background: #fef2f2;
}
.wordset-detail-section h3{
    font-size: 16px;
    margin-bottom: 8px;
}
.wordset-detail-header{
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}
.btn-back-sm{
    padding: 5px 14px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text);
}
.btn-back-sm:hover{
    border-color: var(--primary);
    background: #faf5ff;
}
.wordset-detail-stats{
    display: flex;
    gap: 20px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}
.detail-stat{
    font-size: 13px;
    color: var(--text-light);
}
.detail-stat strong{
    color: var(--primary);
    font-size: 16px;
}
.word-table-wrap{
    overflow-x: auto;
    margin-bottom: 12px;
}
.word-table{
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.word-table th{
    background: rgba(124,58,237,0.08);
    padding: 8px 10px;
    text-align: left;
    font-weight: 700;
    color: var(--text);
    border-bottom: 2px solid rgba(124,58,237,0.15);
}
.word-table td{
    padding: 6px 10px;
    border-bottom: 1px solid #f3f4f6;
    color: var(--text-light);
}
.wt-word{
    font-weight: 700;
    color: var(--text) !important;
}
.wt-chinese{
    color: var(--text) !important;
}
.wt-phonetic{
    font-family: 'Courier New', monospace;
    font-size: 12px;
}
.word-pagination{
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}
.pg-btn{
    min-width: 32px;
    height: 32px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: #fff;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text);
}
.pg-btn:hover{
    border-color: var(--primary);
    background: #faf5ff;
}
.pg-btn.active{
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* ===== 响应式 ===== */
@media (max-width: 768px){
    .mode-row{ flex-wrap: wrap; }
    .lesson-grid{ grid-template-columns: repeat(7, 1fr); }
    .options-grid{ grid-template-columns: 1fr; }
    .stats-grid{ grid-template-columns: repeat(2, 1fr); }
    .result-stats{ grid-template-columns: repeat(2, 1fr); }
    .question-main{ font-size: 38px; }
    .quiz-card{ padding: 24px 16px; max-width: 100%; }
    .topbar{ padding: 8px 14px; }
    .topbar-right .badge{ display: none; }
    .mode-stats-grid{ grid-template-columns: 1fr; }
    .view{ max-width: 100%; }
    .view-container{ padding: 12px; }
    .quiz-columns{ gap: 0; }
    .quiz-side{ display: none; }
    .quiz-center{ width: 100%; }
    .side-feedback-icon{ font-size: 36px; }
    .side-feedback-text{ font-size: 13px; padding: 4px 12px; }
    .vkbd{ max-width: 100%; gap: 4px; }
    .vkbd-row{ gap: 4px; }
    .vkbd-key{ min-width: 0; height: 42px; font-size: 15px; max-width: 40px; }
    .vkbd-key-del{ max-width: 56px; }
    .spell-input{ font-size: 18px; padding: 12px 14px; }
    .spell-hint{ font-size: 22px; letter-spacing: 4px; }
}
