/* ============================================
   VocabType Pro - 训练页面专用样式
   ============================================ */

.train-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 24px;
    max-width: 1200px;
    margin: 0 auto;
}

/* ---- 训练控制栏 ---- */
.train-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.mode-selector {
    display: flex;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    padding: 3px;
    border: 1px solid var(--border);
}

.mode-option {
    padding: 7px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
    cursor: pointer;
}
.mode-option.active {
    background: var(--accent);
    color: white;
    box-shadow: 0 2px 8px rgba(var(--accent-rgb), 0.3);
}

.timer-display {
    font-family: 'Outfit', monospace;
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
    background: var(--bg-tertiary);
    padding: 6px 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    letter-spacing: 1px;
}

.progress-indicator {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
}
.progress-indicator strong { color: var(--accent); }

/* ---- 题目展示区 ---- */
.question-zone {
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-light);
    padding: 40px 36px;
    text-align: center;
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
}

.question-zone::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--accent), var(--warm), var(--accent));
    opacity: 0.6;
}

.question-label {
    font-size: 13px;
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 16px;
}

.question-text {
    font-family: 'Noto Sans SC', sans-serif;
    font-size: 34px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.4;
    word-break: break-word;
    margin-bottom: 8px;
}

.audio-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px; height: 44px;
    border-radius: 50%;
    background: var(--accent-glow);
    color: var(--accent);
    margin-left: 12px;
    vertical-align: middle;
    transition: all var(--transition-base);
    cursor: pointer;
    border: 2px solid transparent;
}
.audio-btn:hover {
    background: var(--accent);
    color: white;
    transform: scale(1.08);
}
.audio-btn.playing {
    animation: pulse-ring 1.5s infinite;
    border-color: var(--accent);
}

/* ---- 输入区域 ---- */
.input-zone {
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    border: 2px solid var(--border);
    padding: 32px 36px;
    margin-bottom: 24px;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    position: relative;
}

.input-zone.focused {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-glow);
}

.input-zone.correct {
    border-color: var(--success);
    box-shadow: 0 0 0 4px rgba(16,185,129,0.15);
    animation: correct-flash 0.6s ease;
}

.input-zone.wrong {
    border-color: var(--error);
    box-shadow: 0 0 0 4px rgba(239,68,68,0.15);
    animation: shake 0.4s ease;
}

.input-hint {
    font-size: 13px;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 20px;
}

.word-input-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-bottom: 20px;
}

.word-slot {
    display: flex;
    align-items: center;
    gap: 6px;
}

.word-input {
    min-width: 100px;
    padding: 10px 16px;
    border: 2px dashed var(--border);
    border-radius: var(--radius-md);
    font-family: 'Be Vietnam Pro', 'Noto Sans SC', sans-serif;
    font-size: 17px;
    font-weight: 600;
    text-align: center;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    transition: all var(--transition-fast);
}
.word-input:focus {
    border-style: solid;
    border-color: var(--accent);
    background: white;
    box-shadow: 0 0 0 3px var(--accent-glow);
}
.word-input.correct {
    border-color: var(--success);
    border-style: solid;
    background: var(--success-bg);
    color: var(--success);
}
.word-input.wrong {
    border-color: var(--error);
    border-style: solid;
    background: var(--error-bg);
    color: var(--error);
}

.sentence-input {
    width: 100%;
    padding: 16px 20px;
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    font-family: 'Be Vietnam Pro', 'Noto Sans SC', sans-serif;
    font-size: 20px;
    font-weight: 600;
    text-align: center;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    letter-spacing: 0.5px;
    transition: all var(--transition-fast);
}
.sentence-input:focus {
    border-style: solid;
    border-color: var(--accent);
    background: white;
    box-shadow: 0 0 0 4px var(--accent-glow);
}
.sentence-input.correct {
    border-color: var(--success);
    border-style: solid;
    background: var(--success-bg);
    color: var(--success);
}
.sentence-input.wrong {
    border-color: var(--error);
    border-style: solid;
    background: var(--error-bg);
    color: var(--error);
}

.char-correct { color: var(--success); font-weight: 700; }
.char-wrong { 
    color: var(--error); 
    text-decoration: underline wavy var(--error);
    text-underline-offset: 4px;
}
.char-pending { color: var(--text-muted); }

/* ---- 虚拟键盘 ---- */
.keyboard-container {
    background: var(--bg-tertiary);
    border-radius: var(--radius-lg);
    padding: 16px;
    margin-bottom: 20px;
}

.keyboard-row {
    display: flex;
    justify-content: center;
    gap: 5px;
    margin-bottom: 5px;
}

.key {
    min-width: 38px; height: 42px;
    display: flex; align-items: center; justify-content: center;
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition-fast);
    user-select: none;
    box-shadow: 0 2px 0 var(--border);
    position: relative;
}
.key:hover { background: var(--bg-primary); transform: translateY(-1px); }
.key:active, .key.pressed {
    transform: translateY(2px);
    box-shadow: 0 0 0 var(--border);
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}
.key-wide { min-width: 62px; }
.key-extra-wide { min-width: 82px; }
.key-vi {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border-color: #f59e0b;
    color: #92400e;
    font-size: 13px;
}
.key-vi:hover { background: #fde68a; }
.key-vi:active, .key-vi.pressed {
    background: var(--warm);
    color: white;
    border-color: var(--warm);
}

/* ---- 操作按钮栏 ---- */
.action-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.action-bar-left { display: flex; gap: 10px; }
.action-bar-right { display: flex; gap: 10px; }

.hint-text {
    font-size: 13px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}
.kbd-hint {
    display: inline-block;
    padding: 2px 8px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-family: monospace;
    font-size: 11px;
    font-weight: 600;
}

/* ---- 右侧统计面板 ---- */
.side-panel {
    position: sticky;
    top: calc(var(--header-height) + 28px);
}

.stat-panel {
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-light);
    overflow: hidden;
}

.panel-section {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-light);
}
.panel-section:last-child { border-bottom: none; }

.panel-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 14px;
}

.ring-center {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.accuracy-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.mini-stat {
    text-align: center;
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
}
.mini-stat-value {
    font-family: 'Outfit', sans-serif;
    font-size: 22px;
    font-weight: 800;
    color: var(--text-primary);
}
.mini-stat-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}
.mini-stat-value.success { color: var(--success); }
.mini-stat-value.error { color: var(--error); }

/* ---- 结果弹窗 ---- */
.result-modal {
    text-align: center;
}
.result-score {
    font-family: 'Outfit', sans-serif;
    font-size: 72px;
    font-weight: 900;
    background: linear-gradient(135deg, var(--accent), var(--warm));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
    margin: 16px 0;
}
.result-label { font-size: 16px; color: var(--text-secondary); }
.result-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin: 24px 0;
}
.result-item {
    padding: 16px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
}
.result-item-value {
    font-family: 'Outfit', sans-serif;
    font-size: 24px;
    font-weight: 800;
}
.result-item-label { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ---- 日历热力图 ---- */
.heatmap-grid {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 3px;
}
.heatmap-cell {
    aspect-ratio: 1;
    border-radius: 3px;
    background: var(--bg-tertiary);
    position: relative;
    cursor: default;
    transition: transform var(--transition-fast);
}
.heatmap-cell:hover { transform: scale(1.3); z-index: 1; }
.heatmap-cell.level-0 { background: #ebedf0; }
.heatmap-cell.level-1 { background: #9be9a8; }
.heatmap-cell.level-2 { background: #40c463; }
.heatmap-cell.level-3 { background: #30a14e; }
.heatmap-cell.level-4 { background: #216e39; }

.heatmap-cell[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-dark);
    color: white;
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-fast);
    margin-bottom: 4px;
}
.heatmap-cell:hover::after { opacity: 1; }

/* ---- 排行榜 ---- */
.rank-list { list-style: none; }
.rank-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border-radius: var(--radius-md);
    transition: background var(--transition-fast);
    animation: fadeIn 0.3s ease backwards;
}
.rank-item:nth-child(1) { animation-delay: 0.03s; }
.rank-item:nth-child(2) { animation-delay: 0.06s; }
.rank-item:nth-child(3) { animation-delay: 0.09s; }
.rank-item:nth-child(n+4) { animation-delay: 0.12s; }
.rank-item:hover { background: var(--bg-tertiary); }
.rank-item.me { background: var(--accent-glow); border: 1px solid var(--accent); }

.rank-number {
    width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 14px;
    flex-shrink: 0;
}
.rank-number.gold { background: linear-gradient(135deg, #ffd700, #ffb300); color: #7c4000; }
.rank-number.silver { background: linear-gradient(135deg, #c0c0c0, #a0a0a0); color: #555; }
.rank-number.bronze { background: linear-gradient(135deg, #cd7f32, #b87333); color: white; }
.rank-number.normal { background: var(--bg-tertiary); color: var(--text-muted); }

.rank-avatar {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    display: flex; align-items: center; justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}
.rank-info { flex: 1; min-width: 0; }
.rank-name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-detail { font-size: 12px; color: var(--text-muted); }
.rank-score {
    font-family: 'Outfit', sans-serif;
    font-size: 18px;
    font-weight: 800;
    color: var(--accent);
}

/* ---- 错题卡片 ---- */
.wrong-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    border-left: 4px solid var(--error);
    padding: 20px;
    margin-bottom: 12px;
    transition: box-shadow var(--transition-base);
}
.wrong-card:hover { box-shadow: var(--shadow-md); }

.wrong-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}
.wrong-count-badge {
    background: var(--error);
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: var(--radius-full);
}

.wrong-original {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}
.wrong-answer-row {
    display: flex;
    gap: 20px;
    font-size: 13px;
}
.wrong-answer-label { color: var(--text-muted); }
.wrong-answer-text { font-weight: 600; }
.wrong-answer-text.right { color: var(--success); }
.wrong-answer-text.wrong-text { color: var(--error); text-decoration: line-through; }

/* ---- 复习列表 ---- */
.review-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
    margin-bottom: 8px;
    transition: all var(--transition-fast);
}
.review-item:hover { border-color: var(--accent); }
.review-item.urgent { border-left: 3px solid var(--warm); }
.review-checkbox {
    width: 22px; height: 22px;
    border-radius: 6px;
    border: 2px solid var(--border);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}
.review-checkbox.checked {
    background: var(--accent);
    border-color: var(--accent);
}
.review-content { flex: 1; min-width: 0; }
.review-text { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.review-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.review-level {
    font-size: 11px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    flex-shrink: 0;
}

/* ---- 图表容器 ---- */
.chart-container {
    position: relative;
    height: 280px;
    width: 100%;
}

/* ---- 上传区域 ---- */
.upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius-xl);
    padding: 48px 24px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-base);
    background: var(--bg-tertiary);
}
.upload-zone:hover, .upload-zone.dragover {
    border-color: var(--accent);
    background: var(--accent-glow);
}
.upload-zone svg { 
    width: 52px; height: 52px; 
    color: var(--text-muted); 
    margin: 0 auto 12px;
}
.upload-zone p { color: var(--text-secondary); font-size: 14px; }
.upload-zone .hint { color: var(--text-muted); font-size: 12px; margin-top: 4px; }

/* 步骤条 */
.steps-progress {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 28px 0;
    position: relative;
}
.steps-progress::before {
    content: '';
    position: absolute;
    top: 20px; left: 40px; right: 40px;
    height: 2px;
    background: var(--border);
}
.step-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 1;
}
.step-dot {
    width: 40px; height: 40px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px;
    font-weight: 700;
    background: var(--bg-tertiary);
    color: var(--text-muted);
    border: 2px solid var(--border);
    transition: all var(--transition-base);
}
.step-item.active .step-dot {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
    box-shadow: var(--shadow-glow);
}
.step-item.done .step-dot {
    background: var(--success);
    color: white;
    border-color: var(--success);
}
.step-label { font-size: 11px; color: var(--text-muted); margin-top: 6px; font-weight: 600; }
.step-item.active .step-label { color: var(--accent); }

/* 响应式训练页 */
@media (max-width: 1024px) {
    .train-layout { grid-template-columns: 1fr; }
    .side-panel { position: static; }
    .question-text { font-size: 28px; }
}
@media (max-width: 768px) {
    .train-controls { flex-direction: column; align-items: stretch; }
    .control-group { justify-content: center; }
    .action-bar { flex-direction: column; }
    .question-zone { padding: 28px 20px; }
    .question-text { font-size: 24px; }
    .sentence-input { font-size: 17px; padding: 12px 16px; }
    .keyboard-container { padding: 10px; overflow-x: auto; }
    .key { min-width: 32px; height: 36px; font-size: 12px; }
}
