/* ==========================================================================
   Minerva 打字练习核心样式 (page-practice.css)
   ========================================================================== */

/* 全局与容器 */
:root {
    --color-primary: #9333ea;
    --color-primary-light: #f3e8ff;
    --color-success: #2ecc71;
    --color-danger: #e74c3c;
    --text-main: #333333;
    --text-muted: #6b7280;
    --bg-page: #f8fafc;
    --bg-card: #ffffff;
}

body {
    background-color: var(--bg-page);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.practice-main {
    max-width: 800px;
    margin: 30px auto;
    padding: 0 20px;
}

/* 1. 顶部信息栏 */
.practice-info-bar {
    background: var(--color-primary-light);
    border-radius: 16px;
    padding: 15px 25px;
    margin-bottom: 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    border: 1px solid rgba(147, 51, 234, 0.2);
}
.practice-info-item { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--color-primary); }
.practice-info-item span { color: var(--text-main); }

/* 2. 数据统计栏 */
.stats {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 25px;
}
.stat {
    background: var(--bg-card);
    padding: 10px 20px;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    font-weight: 600;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
}
.stat i { color: var(--color-primary); }
.stat span { color: var(--text-main); font-size: 1.1rem; }

/* 3. 单词卡片核心 */
.word-card-container { margin-bottom: 30px; }
.word-card {
    background: var(--bg-card);
    border-radius: 24px;
    padding: 40px;
    box-shadow: 0 10px 30px rgba(147, 51, 234, 0.08);
    position: relative;
    border: 1px solid #f1f5f9;
}

/* 进度条 */
.word-counter { position: absolute; top: 20px; right: 25px; text-align: right; }
.progress-text { font-size: 0.85rem; color: var(--text-muted); font-weight: bold; }
.progress-bar { width: 120px; height: 8px; background: #e2e8f0; border-radius: 10px; margin-top: 5px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, #9333ea, #c084fc); transition: width 0.3s ease; }

/* 单词显示 */
.main-word {
    text-align: center;
    font-size: 3rem;
    font-weight: 800;
    color: var(--color-primary);
    letter-spacing: 2px;
    min-height: 80px;
    display: flex;
    justify-content: center;
    align-items: center;
}
.char { display: inline-block; position: relative; transition: all 0.1s; }
.char.current { border-bottom: 3px solid var(--color-primary); color: var(--color-primary); transform: scale(1.1); }
.char.correct { color: var(--color-success); }
.char.incorrect { color: var(--color-danger); background: rgba(231, 76, 60, 0.15); border-radius: 4px; }

/* 单词解释详情区 */
.word-details-box {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px dashed #cbd5e1;
    text-align: center;
    min-height: 80px;
}
.txt-phonetic { color: #888; font-family: "Lucida Console", Monaco, monospace; margin-right: 15px; }
.tag-pos { background: #e0f2fe; color: #0369a1; padding: 4px 8px; border-radius: 6px; font-size: 0.85rem; font-weight: bold; margin-right: 10px; }
.txt-trans { color: var(--text-main); font-weight: bold; font-size: 1.1rem; }
.txt-example { color: var(--text-muted); font-style: italic; margin-top: 10px; line-height: 1.5; font-size: 0.95rem; }

/* 4. 虚拟软键盘 (英文模式) */
.virtual-keyboard {
    background: rgba(248, 250, 252, 0.8);
    padding: 15px;
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
    opacity: 0.5;
    transition: opacity 0.3s;
}
.virtual-keyboard.active { opacity: 1; }
.keyboard-row { display: flex; justify-content: center; gap: 6px; }
.key {
    min-width: 45px; height: 50px; background: white; border: 1px solid #cbd5e1; border-bottom: 4px solid #94a3b8;
    border-radius: 8px; display: flex; align-items: center; justify-content: center; font-weight: 700; color: #475569;
    transition: all 0.1s; text-transform: uppercase;
}
.key.wide { width: 80px; font-size: 0.9rem; }
.key.space { width: 250px; }
.key.pressed { background: var(--color-primary); border-color: var(--color-primary); border-bottom-width: 1px; transform: translateY(3px); color: white; }
.key.hit-wrong { background: var(--color-danger); border-color: #c0392b; border-bottom-width: 1px; transform: translateY(3px); color: white; }

/* 5. 输入区与按钮 */
.input-area { text-align: center; }
.chinese-input-box {
    width: 100%; max-width: 500px; height: 80px; margin: 0 auto 20px; padding: 15px;
    font-size: 1.5rem; border: 2px solid #cbd5e1; border-radius: 16px; text-align: center;
    transition: 0.3s; box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}
.chinese-input-box:focus { border-color: var(--color-primary); outline: none; box-shadow: 0 0 0 3px var(--color-primary-light); }

/* 英文沉浸式：完全隐藏真实的输入框 */
.typing-ghost { position: absolute; opacity: 0; pointer-events: none; height: 0; width: 0; z-index: -1; }

.action-buttons { display: flex; justify-content: center; gap: 15px; }
.btn { padding: 12px 30px; border-radius: 50px; font-weight: bold; font-size: 1rem; border: none; cursor: pointer; transition: 0.2s; display: flex; align-items: center; gap: 8px; }
.btn-primary { background: var(--color-primary); color: white; box-shadow: 0 4px 15px rgba(147, 51, 234, 0.3); }
.btn-primary:hover { background: #7e22ce; transform: translateY(-2px); }
.btn-secondary {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); /* 温暖橙色渐变 */
    color: white;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(245, 158, 11, 0.4);
}

.btn-secondary:active {
    transform: translateY(0);
}

/* 6. 结算弹窗 Modal */
.result-modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(15, 23, 42, 0.8); backdrop-filter: blur(5px);
    display: none; justify-content: center; align-items: center; z-index: 9999;
    opacity: 0; transition: opacity 0.3s;
}
.result-modal-overlay.active { display: flex; opacity: 1; }
.result-modal-content {
    background: white; width: 90%; max-width: 420px; padding: 40px; border-radius: 30px;
    text-align: center; transform: scale(0.8); transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.result-modal-overlay.active .result-modal-content { transform: scale(1); }
.medal-icon { width: 80px; height: 80px; background: linear-gradient(135deg, #fbbf24, #f59e0b); border-radius: 50%; margin: 0 auto 20px; display: flex; justify-content: center; align-items: center; color: white; font-size: 35px; box-shadow: 0 10px 20px rgba(245, 158, 11, 0.3); }
.res-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 30px 0; }
.res-card { background: #f8fafc; padding: 15px 10px; border-radius: 16px; border: 1px solid #e2e8f0; }
.res-card small { color: var(--text-muted); font-size: 0.8rem; font-weight: bold; }
.res-card b { display: block; font-size: 1.5rem; color: var(--color-primary); margin-top: 5px; }

.btn-success {
    background: var(--color-success);
    color: white;
    box-shadow: 0 4px 15px rgba(46, 204, 113, 0.3);
}
.btn-success:hover {
    background: #27ae60;
    transform: translateY(-2px);
}

@media (max-width: 768px) {
    .virtual-keyboard { padding: 10px; gap: 4px; }
    .key { min-width: 32px; height: 42px; font-size: 0.85rem; border-bottom-width: 3px; }
    .key.space { width: 150px; }
    .main-word { font-size: 2.2rem; }
}