/* 基础样式 */
:root {
    --animation-duration: 0.2s;
}

body.theme-light {
    --bg-color: #f8fafc;
    --text-color: #1e293b;
    --card-bg: #ffffff;
    --primary-color: #3b82f6;
    --secondary-color: #93c5fd;
    --success-color: #22c55e;
    --error-color: #ef4444;
}

body.theme-dark {
    --bg-color: #0f172a;
    --text-color: #e2e8f0;
    --card-bg: #1e293b;
    --primary-color: #60a5fa;
    --secondary-color: #3b82f6;
    --success-color: #4ade80;
    --error-color: #f87171;
}

body.theme-minecraft {
    --bg-color: #5E3D25;
    --text-color: #F2F2F2;
    --card-bg: #8B8B8B;
    --primary-color: #4AAE46;
    --secondary-color: #72BB70;
    --success-color: #52c41a;
    --error-color: #f5222d;
}

/* Minecraft字体 */
@font-face {
    font-family: 'Minecraft';
    src: url('https://cdn.jsdelivr.net/gh/South-Paw/typeface-minecraft@master/font/minecraft.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
}

.theme-minecraft * {
    font-family: 'Minecraft', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* 键盘输入焦点样式 */
#app:focus {
    outline: none;
}

/* 单词显示区动画 */
.word-container {
    transition: transform var(--animation-duration) ease;
}

.word-container.correct {
    transform: scale(1.05);
}

.word-container.error {
    animation: shake 0.4s cubic-bezier(.36,.07,.19,.97) both;
}

/* 正确/错误反馈 */
#typing-feedback.correct {
    color: var(--success-color);
}

#typing-feedback.error {
    color: var(--error-color);
}

/* 抖动动画 */
@keyframes shake {
    10%, 90% { transform: translate3d(-1px, 0, 0); }
    20%, 80% { transform: translate3d(2px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
    40%, 60% { transform: translate3d(4px, 0, 0); }
}

/* 隐藏过渡动画 */
.modal {
    transition: opacity 0.3s ease;
}

.modal-content {
    transition: transform 0.3s ease, opacity 0.3s ease;
}

/* 自定义滚动条 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* 按钮悬停效果 */
button {
    transition: all 0.2s ease;
}

button:active {
    transform: scale(0.95);
}

/* 光标闪烁 */
@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

.cursor-blink {
    animation: blink 1s step-end infinite;
}

/* 辉光效果 */
.glow {
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
}

/* 字母输入动画 */
@keyframes letterPop {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.letter-pop {
    animation: letterPop 0.2s ease;
    display: inline-block;
}

/* 完成动画 */
@keyframes completedWord {
    0% { opacity: 1; transform: scale(1); }
    100% { opacity: 0; transform: scale(1.2) translateY(-20px); }
}

.completed-animation {
    animation: completedWord 0.5s ease forwards;
}

/* 主题切换动画 */
body {
    transition: background-color 0.5s ease, color 0.5s ease;
}

/* 进度条填充动画 */
#progress-fill {
    transition: width 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

/* 打字反馈区域 */
#typing-feedback {
    transition: color 0.3s ease;
    min-height: 2rem;
}

/* 单词部分样式 */
#completed-part, #current-char, #remaining-part {
    transition: color 0.2s ease;
}

/* 彩带动画 - 修复为在弹窗内显示 */
.confetti-container {
    position: absolute;
    inset: 0;
    z-index: 10;
    overflow: hidden;
    border-radius: inherit;
}

.confetti {
    position: absolute;
    width: 8px;
    height: 16px;
    opacity: 0.7;
    animation: confetti-fall 3s ease-in-out forwards, confetti-shake 2s ease-in-out infinite;
    z-index: 10;
    transform-origin: center;
}

@keyframes confetti-fall {
    0% { top: -20px; transform: translateY(0) rotate(0deg); }
    100% { top: 100%; transform: translateY(0) rotate(360deg); }
}

@keyframes confetti-shake {
    0% { margin-left: 0; }
    50% { margin-left: 15px; }
    100% { margin-left: 0; }
}

/* 不同颜色的彩带 */
.confetti.red { background-color: #f44336; }
.confetti.blue { background-color: #2196f3; }
.confetti.green { background-color: #4caf50; }
.confetti.yellow { background-color: #ffeb3b; }
.confetti.purple { background-color: #9c27b0; }

/* 统计气泡框 */
.stats-bubble {
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(4px);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stats-bubble:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.15);
}

/* 进度条完成动画 */
@keyframes progressComplete {
    0% { background-color: var(--primary-color); }
    50% { background-color: var(--success-color); }
    100% { background-color: var(--success-color); }
}

.progress-completed {
    animation: progressComplete 1s ease forwards;
}

/* 不熟悉单词列表样式 */
#difficult-words-list::-webkit-scrollbar {
    width: 6px;
}

#difficult-words-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

#difficult-words-list::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 10px;
}

.difficult-word-item {
    padding: 0.5rem;
    margin-bottom: 0.5rem;
    border-radius: 0.5rem;
    background-color: white;
    border-left: 3px solid #ef4444;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.difficult-word-item:last-child {
    margin-bottom: 0;
}

/* 修复下拉菜单问题 */
select {
    cursor: pointer;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    z-index: 10;
}

select:hover {
    border-color: var(--primary-color);
}

/* 自适应样式 */
@media (max-width: 768px) {
    #current-word {
        font-size: 2.5rem;
    }
    
    .word-container {
        padding: 1.5rem 1rem;
    }
    
    .stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    #current-word {
        font-size: 2rem;
    }
    
    .word-container {
        padding: 1rem 0.5rem;
    }
}
/* 添加到style.css末尾 */

/* 词典卡片样式 */
.dictionary-card {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.dictionary-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
}

.dictionary-card.active {
    border-color: currentColor;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

/* 开始按钮样式 */
#start-btn {
    position: relative;
    overflow: hidden;
}

#start-btn::after {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: all 0.5s;
}

#start-btn:hover::after {
    left: 100%;
}
/* 添加到style.css中 */
#completed-part {
    color: #22c55e; /* 绿色 - 已输入正确的部分 */
}

#current-char {
    color: #3b82f6; /* 蓝色 - 当前字符 */
}

#remaining-part {
    color: #1e293b; /* 默认颜色 - 未输入的部分 */
}

#current-char.error {
    color: #ef4444; /* 红色 - 输入错误时的当前字符 */
}

.word-container.correct #completed-part,
.word-container.correct #current-char,
.word-container.correct #remaining-part {
    color: #22c55e; /* 全部变绿色 - 单词完全正确时 */
}

.word-container.error #current-char {
    color: #ef4444; /* 红色 - 输入错误时的当前字符 */
}
/* 错题本样式 */
.error-word-row {
    transition: background-color 0.2s ease;
}

.error-word-row:hover {
    background-color: rgba(239, 246, 255, 0.6);
}

.error-word-row td {
    border-bottom: 1px solid #e2e8f0;
    padding: 12px 16px;
}

.error-count-badge {
    background-color: #ef4444;
    color: white;
    font-size: 0.75rem;
    line-height: 1;
    border-radius: 9999px;
    padding: 0.125rem 0.375rem;
}

.error-book-action-btn {
    padding: 0.375rem;
    border-radius: 0.375rem;
    transition: all 0.2s ease;
}

.error-book-action-btn:hover {
    background-color: #f1f5f9;
}

/* 错题本分页样式 */
.error-book-pagination-btn {
    transition: all 0.2s ease;
}

.error-book-pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 单词发音按钮 */
.pronounce-btn {
    color: #3b82f6;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pronounce-btn:hover {
    color: #2563eb;
}
/* 添加到style.css中 */
.dictation-mode #remaining-part {
    font-family: monospace;
    letter-spacing: 4px;
    font-size: inherit;
    font-weight: bold;
}

.dictation-mode #completed-part {
    font-family: monospace;
    letter-spacing: 4px;
    font-size: inherit;
}

/* 确保默写模式和正常模式位置一致 */
#completed-part, #current-char, #remaining-part {
    position: relative;
    display: inline-block;
    height: 1.2em;
    vertical-align: baseline;
    line-height: 1.2;
}

/* 确保鼠标悬停时字体样式一致 */
.word-container.dictation-mode:hover #remaining-part {
    letter-spacing: normal;
    font-family: inherit;
}
/* 添加到style.css中 */
.dictation-mode #completed-part.text-red-500 {
    color: #ef4444; /* 错误时的红色 */
    text-decoration: underline;
    text-decoration-color: #ef4444;
    font-family: monospace;
    letter-spacing: 4px;
    font-size: inherit;
}

.dictation-mode #remaining-part.text-red-300 {
    color: #fca5a5; /* 错误时剩余部分的浅红色 */
    font-family: monospace;
    letter-spacing: 4px;
    font-size: inherit;
}
/* 添加到style.css中 */

/* 默写模式下的底部下划线样式 */
.dictation-mode .underline-text {
    position: relative;
    font-family: monospace;
    letter-spacing: 4px;
    z-index: 1;
}

/* 用户输入的文本悬浮在下划线上方 */
.dictation-mode .input-text {
    position: relative;
    font-family: monospace;
    letter-spacing: 4px;
    z-index: 2;
}

/* 下划线错误闪烁动画 */
@keyframes errorFlash {
    0%, 100% { color: #ef4444; }
    50% { color: #fca5a5; }
}

.error-flash {
    animation: errorFlash 0.5s ease;
}

/* 确保整个容器有相对定位 */
.word-container.dictation-mode {
    position: relative;
}

/* 确保整个单词容器的字体保持一致 */
.dictation-mode #completed-part,
.dictation-mode #current-char,
.dictation-mode #remaining-part {
    font-family: monospace;
    letter-spacing: 4px;
}

/* 给下划线字符添加较深的颜色以确保可见性 */
.dictation-mode .underline-text {
    color: #94a3b8; /* slate-400 */
}