/* ==================== 与064/065/066完全统一的样式 ==================== */

:root {
    --primary-color: #2196f3;
    --primary-light: #4caf50;
    --primary-dark: #1976d2;
    --primary-gradient: var(--primary-color);
    --success-color: #4caf50;
    --warning-color: #ff9800;
    --error-color: #f44336;
    --info-color: #2196f3;
    --text-primary: #2c3e50;
    --text-secondary: #6c757d;
    --text-light: #95a5a6;
    --bg-primary: #f8f9fa;
    --bg-white: #ffffff;
    --border-color: #e8f0fe;
    --border-radius: 12px;
    --border-radius-lg: 20px;
    --box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    --box-shadow-hover: 0 8px 30px rgba(0, 0, 0, 0.12);
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #f6f9fc 0%, #eef2f6 100%);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

body.game-active { height: 100vh; overflow: hidden; position: fixed; width: 100%; }

.main-container { max-width: 900px; margin: 2rem auto; }

.card {
    background: rgba(255,255,255,.98); border-radius: var(--border-radius-lg);
    box-shadow: var(--box-shadow); backdrop-filter: blur(10px);
    transition: var(--transition-normal); overflow: hidden; padding: 0; margin-bottom: 20px;
}
.card:hover { box-shadow: var(--box-shadow-hover); }

.hidden { display: none !important; }
.section { transition: opacity .3s ease; }

/* 蓝色头部 */
.card-header { padding: 1.75rem 2rem; background: var(--primary-gradient); text-align: center; border-bottom: none; }
.card-title { color: white; font-size: 1.5rem; font-weight: 600; letter-spacing: .5px; margin-bottom: .5rem; }
.card-desc { color: rgba(255,255,255,.85); font-size: .95rem; }
.card-body { padding: 2rem; }

/* 训练说明（统一060标准样式） */
.instructions { background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%); padding: 1.5rem; border-radius: var(--border-radius); margin: 1.5rem 0; border: 1px solid var(--border-color); border-left: 4px solid var(--primary-color); }
.instructions-title { font-size: 1.125rem; font-weight: 600; color: var(--text-primary); margin-bottom: 1rem; }
.instructions-list { list-style: none; padding-left: 0; }
.instructions-list li { padding: 0.625rem 0; padding-left: 2rem; position: relative; font-size: 0.95rem; color: var(--text-secondary); }
.instructions-list li::before { content: "✓"; position: absolute; left: 0; color: var(--success-color); font-weight: 600; }

/* 按钮组（统一060标准样式） */
.button-group { display: flex; flex-direction: column; gap: 1rem; }
@media (min-width: 480px) { .button-group { flex-direction: row; } }
.button-group .btn { flex: 1; }

/* 难度选择 */
.difficulty-section { margin-bottom: 1.25rem; }
.form-select {
    width: 100%; padding: 14px 18px; font-size: 1rem; font-weight: 500; color: var(--text-primary);
    background: linear-gradient(145deg,#fff 0%,#f0f4f8 100%); border: 2px solid var(--border-color);
    border-radius: var(--border-radius); cursor: pointer; transition: all .3s ease; appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%232196f3' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 14px center; background-size: 18px; padding-right: 44px;
}
.form-select:focus { outline: none; border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(33,150,243,.15); }
.form-select option { padding: 10px; }

/* 统计信息 */
.stats-info { text-align: center; font-size: .9rem; color: var(--text-light); padding: 10px; background: #f8fafb; border-radius: var(--border-radius); margin-bottom: 1rem; }

/* 按钮 */
.btn {
    padding: .875rem 2rem; font-size: 1rem; font-weight: 600; border: none;
    border-radius: var(--border-radius); cursor: pointer; transition: var(--transition-normal);
    display: inline-flex; align-items: center; justify-content: center; gap: .5rem; font-family: inherit;
}
.btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,.15); }
.btn:active:not(:disabled) { transform: translateY(0); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none !important; }
.btn-icon { font-size: 1.125rem; }
.btn-large { width: 100%; padding: 1rem; font-size: 1.125rem; }
.btn-primary { background: linear-gradient(135deg,var(--primary-color) 0%,var(--primary-dark) 100%); color: white; box-shadow: 0 4px 12px rgba(33,150,243,.3); }
.btn-primary:hover:not(:disabled) { background: linear-gradient(135deg,var(--primary-dark) 0%,#1565c0 100%); box-shadow: 0 6px 16px rgba(33,150,243,.4); }
.btn-secondary { background: var(--success-color); color: white; box-shadow: 0 4px 12px rgba(76,175,80,.3); }
.btn-secondary:hover:not(:disabled) { background: #45a049; box-shadow: 0 6px 16px rgba(76,175,80,.4); }
.btn-outline { background: transparent; color: var(--text-secondary); border: 2px solid var(--border-color); }
.btn-outline:hover:not(:disabled) { border-color: var(--primary-color); color: var(--primary-color); transform: translateY(-2px); }
.btn-danger { background: var(--error-color); color: white; }
.btn-danger:hover:not(:disabled) { background: #d32f2f; }

/* 按钮组 */
.button-group { display: flex; flex-direction: column; gap: 1rem; }
@media (min-width: 480px) { .button-group { flex-direction: row; } }
.button-group .btn { flex: 1; }

/* ==================== 游戏头部 ==================== */
.game-header {
    display: flex; justify-content: space-between; align-items: center; flex-wrap: nowrap;
    padding: 1rem 1.25rem; background: linear-gradient(135deg,#f8f9fa 0%,#fff 100%);
    border-bottom: 1px solid var(--border-color); gap: 8px;
}
.game-info { display: flex; gap: 1rem; align-items: center; }
.info-item { display: flex; flex-direction: column; gap: .25rem; }
.info-label { font-size: .75rem; color: var(--text-secondary); font-weight: 500; }
.info-value { font-size: 1.25rem; font-weight: 600; color: var(--text-primary); }
.timer-value { font-family: 'Courier New',monospace; color: var(--primary-color); font-size: 1.5rem; }
.timer-value.urgent { color: var(--error-color) !important; }
.time-highlight { color: var(--primary-color); font-family: 'Courier New',monospace; }
.game-actions { display: flex; gap: 4px; flex-shrink: 0; }
.game-actions .btn { padding: .4rem .6rem; font-size: .78rem; white-space: nowrap; }

/* ==================== 游戏内容 ==================== */
.game-content { padding: 1.5rem 2rem; min-height: 300px; display: flex; flex-direction: column; align-items: center; position: relative; overflow-y: auto; }

.phase-label { font-size: 1.2rem; font-weight: 600; color: var(--primary-color); margin-bottom: 12px; text-align: center; }

/* 数字显示区域 */
.idiom-area {
    width: 100%; text-align: center; margin-bottom: 20px;
    background: linear-gradient(135deg,#e3f2fd 0%,#bbdefb 100%);
    border-radius: var(--border-radius-lg); padding: 20px;
    border: 3px solid var(--primary-color);
}

.idiom-display {
    display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 15px;
}

.idiom-char {
    display: flex; justify-content: center; align-items: center;
    min-width: 55px; height: 65px; padding: 0 12px; background: white;
    border-radius: 10px; font-size: 2rem; font-weight: 700;
    color: var(--primary-color); border: 3px solid var(--primary-color);
    font-family: 'Courier New', monospace;
}

.idiom-char.blank {
    background: linear-gradient(135deg,#ffecb3 0%,#ffe082 100%);
    border-color: #ff9800; color: #e65100;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.idiom-hint { font-size: 1rem; color: var(--text-secondary); font-style: italic; min-height: 24px; }

/* 选择区域 */
.select-area { width: 100%; display: flex; flex-direction: column; align-items: center; }
.select-grid {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 15px;
    width: 100%; max-width: 500px;
}

.option-btn {
    display: flex; justify-content: center; align-items: center;
    padding: 18px; background: white;
    border-radius: var(--border-radius); border: 3px solid var(--border-color);
    font-size: 2rem; font-weight: 700; color: var(--primary-color);
    cursor: pointer; transition: all .2s ease;
    font-family: 'Courier New', monospace;
    min-height: 70px;
}
.option-btn:hover { transform: scale(1.05); border-color: var(--primary-color); box-shadow: 0 4px 12px rgba(33,150,243,.2); }
.option-btn.selected { background: linear-gradient(135deg,#e3f2fd 0%,#bbdefb 100%); border-color: var(--primary-color); }
.option-btn.correct { background: linear-gradient(135deg,#c8e6c9 0%,#a5d6a7 100%); border-color: #4caf50; color: #2e7d32; }
.option-btn.wrong { background: linear-gradient(135deg,#ffcdd2 0%,#ef9a9a 100%); border-color: #f44336; color: #c62828; }
.option-btn:disabled { pointer-events: none; opacity: .7; }

/* 反馈区域 */
.feedback-section { position: fixed; top: 50%; left: 50%; transform: translate(-50%,-50%); text-align: center; z-index: 100; background: white; padding: 2rem 3rem; border-radius: var(--border-radius-lg); box-shadow: 0 12px 40px rgba(0,0,0,.15); }
.feedback-section.hidden { display: none; }
.feedback-icon { font-size: 5rem; margin-bottom: .5rem; }
.feedback-text { font-size: 1.5rem; font-weight: 700; }
.feedback-answer { font-size: 1.1rem; color: var(--text-secondary); margin-top: 8px; }
.feedback-icon.correct { color: var(--success-color); }
.feedback-icon.wrong { color: var(--error-color); }

/* ==================== 结果页面 ==================== */
.result-header { text-align: center; padding: 2rem; background: linear-gradient(135deg,#2196f3 0%,#1976d2 100%); color: white; }
.result-icon { font-size: 4rem; margin-bottom: 1rem; animation: bounce 1s ease; }
@keyframes bounce { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-10px)} }
.result-title { color: white; font-size: 2rem; font-weight: 700; }
.result-stats { display: grid; grid-template-columns: repeat(3,1fr); gap: 1.5rem; padding: 2rem; background: var(--bg-primary); }
.stat-item { text-align: center; padding: 1.5rem; background: white; border-radius: var(--border-radius); box-shadow: 0 2px 8px rgba(0,0,0,.05); transition: var(--transition-normal); }
.stat-item:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,.1); }
.stat-label { font-size: .875rem; color: var(--text-secondary); margin-bottom: .75rem; font-weight: 500; }
.stat-value { font-size: 1.5rem; font-weight: 600; color: var(--text-primary); }

.result-feedback {
    padding: 2rem;
    border-top: 1px solid var(--border-color);
}

.feedback-title {
    color: var(--text-primary);
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.feedback-content {
    color: var(--text-secondary);
    line-height: 1.8;
}
.result-actions { padding: 2rem; display: flex; gap: 1rem; justify-content: center; border-top: 1px solid var(--border-color); flex-wrap: wrap; }
.result-actions .btn { flex: 1; min-width: 140px; }

/* ==================== 记录列表 ==================== */
.records-list { padding: 1rem 0; max-height: 400px; overflow-y: auto; }
.record-item { background: white; padding: 1.25rem; border-radius: var(--border-radius); margin-bottom: .75rem; border: 1px solid var(--border-color); transition: var(--transition-normal); }
.record-item:hover { border-color: var(--primary-color); box-shadow: 0 4px 12px rgba(33,150,243,.1); }
.record-rank { font-size: 1rem; font-weight: 700; color: var(--primary-color); margin-bottom: .5rem; }
.record-info { display: flex; justify-content: space-between; margin-bottom: .5rem; }
.record-name { font-weight: 600; color: var(--text-primary); }
.record-date { font-size: .85rem; color: var(--text-light); }
.record-stats { display: flex; justify-content: space-around; font-size: .9rem; }
.record-correct { color: var(--success-color); font-weight: 600; }
.record-accuracy { color: var(--primary-color); font-weight: 600; }
.record-time { font-weight: 600; }
.loading { text-align: center; padding: 40px 20px; color: var(--text-secondary); font-size: 1rem; }
.empty-message { text-align: center; padding: 40px 20px; color: var(--text-light); font-size: 1rem; }

/* ==================== 模态框 ==================== */
.modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,.5); display: flex; justify-content: center; align-items: center; z-index: 1000; }
.modal.hidden { display: none !important; }
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,.45); z-index: 999; }
.modal-overlay.hidden { display: none !important; }
.modal-content { background-color: white; border-radius: var(--border-radius-lg); box-shadow: 0 12px 40px rgba(0,0,0,.2); width: 90%; max-width: 480px; max-height: 80vh; overflow-y: auto; }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; background: linear-gradient(135deg,#2196f3 0%,#1976d2 100%); color: white; }
.modal-title { margin: 0; font-size: 1.15rem; font-weight: 600; }
.btn-close { background: white; border: none; font-size: 1.4rem; cursor: pointer; color: var(--primary-color); width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; line-height: 1; transition: transform .2s; }
.btn-close:hover { transform: scale(1.15); }
.modal-body { padding: 16px 20px; }
.leaderboard-table { width: 100%; border-collapse: collapse; margin-top: 10px; }
.leaderboard-table th,.leaderboard-table td { padding: 12px; text-align: center; border-bottom: 1px solid var(--border-color); }
.leaderboard-table th { background-color: var(--bg-primary); font-weight: 600; color: var(--text-primary); }
.leaderboard-table .rank { font-weight: bold; width: 60px; }
.leaderboard-table .accuracy { color: var(--success-color); font-weight: 600; }
.leaderboard-content { max-height: 60vh; overflow-y: auto; }

/* ==================== 响应式 ==================== */
@media (max-width: 768px) {
    body.game-active { height: 100vh; height: 100dvh; overflow: hidden; }
    .main-container { margin: .5rem; }
    .card-header,.card-body { padding: 1rem; }
    .card-title { font-size: 1.15rem; }
    .btn-large { padding: .8rem; font-size: 1rem; }
    .game-header { padding: .75rem 1rem; gap: 4px; }
    .game-info { gap: .6rem; }
    .info-label { font-size: .65rem; }
    .info-value { font-size: 1rem; }
    .timer-value { font-size: 1.2rem; }
    .idiom-char { min-width: 45px; height: 55px; font-size: 1.6rem; }
    .select-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .option-btn { padding: 15px; font-size: 1.8rem; min-height: 60px; }
    .result-stats { grid-template-columns: repeat(2,1fr); gap: 1rem; padding: 1.5rem; }
    .stat-value { font-size: 1.25rem; }
    .result-actions { flex-wrap: wrap; }
    .result-actions .btn { min-width: 120px; flex: 1 1 45%; }
    
.result-feedback {
    padding: 2rem;
    border-top: 1px solid var(--border-color);
}

.feedback-title {
    color: var(--text-primary);
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.feedback-content {
    color: var(--text-secondary);
    line-height: 1.8;
}
    
    .modal-content { width: 95%; max-height: 90vh; }
    .leaderboard-table { font-size: .875rem; }
    .leaderboard-table th,.leaderboard-table td { padding: .75rem .5rem; }
    .feedback-section { padding: 1.5rem 2rem; }
    .feedback-icon { font-size: 4rem; }
    .feedback-text { font-size: 1.25rem; }
}

@media (max-width: 480px) {
    .card-header { padding: 1.25rem; }
    .card-title { font-size: 1.125rem; }
    .card-body { padding: 1.25rem; }
    .instructions-mini { padding: .875rem 1rem; }
    .instructions-mini p { font-size: .875rem; }
    .idiom-char { min-width: 38px; height: 48px; font-size: 1.4rem; }
    .idiom-area { padding: 15px; }
    .select-grid { gap: 8px; }
    .option-btn { padding: 12px; font-size: 1.5rem; min-height: 55px; }
    .result-stats { grid-template-columns: 1fr; }
    .result-actions { flex-direction: column; }
    .result-actions .btn { flex: 1 1 100%; }
    .button-group { flex-direction: column; }
    .btn-large { padding: .875rem; font-size: 1rem; }
    .feedback-section { padding: 1.25rem 1.5rem; }
    .feedback-icon { font-size: 3rem; }
    .feedback-text { font-size: 1.15rem; }
}
