/* 打字游戏专用样式 */

.game-container {
    min-height: calc(100vh - 200px);
    padding: 40px 0;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
}

/* 游戏头部 */
.game-header {
    text-align: center;
    margin-bottom: 40px;
    background-color: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: var(--shadow);
}

.game-header h1 {
    font-size: 36px;
    color: var(--primary-color);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.game-header h1 i {
    font-size: 40px;
}

.game-description {
    font-size: 18px;
    color: var(--gray-color);
    margin-bottom: 30px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.game-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.stat {
    background-color: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    transition: var(--transition);
}

.stat:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow);
}

.stat-label {
    display: block;
    font-size: 14px;
    color: var(--gray-color);
    margin-bottom: 8px;
    font-weight: 500;
}

.stat-value {
    display: block;
    font-size: 32px;
    font-weight: 700;
    color: var(--primary-color);
}

#timer {
    color: var(--danger-color);
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

.game-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
    align-items: center;
}

.difficulty-select {
    padding: 12px 20px;
    border: 2px solid var(--primary-color);
    border-radius: 30px;
    font-size: 16px;
    font-family: 'Noto Sans SC', sans-serif;
    background-color: white;
    color: var(--dark-color);
    cursor: pointer;
    transition: var(--transition);
    min-width: 180px;
}

.difficulty-select:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.3);
}

/* 游戏区域 */
.game-area {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 40px;
    margin-bottom: 40px;
}

.typing-area {
    background-color: white;
    padding: 40px;
    border-radius: 15px;
    box-shadow: var(--shadow);
}

/* 单词显示区域 */
.word-display {
    background-color: #f8f9fa;
    padding: 40px;
    border-radius: 10px;
    text-align: center;
    margin-bottom: 30px;
    border: 3px solid var(--primary-color);
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.current-word {
    font-size: 48px;
    font-weight: 700;
    color: var(--dark-color);
    font-family: 'Poppins', monospace;
    letter-spacing: 2px;
    transition: all 0.3s ease;
}

.current-word.correct {
    color: var(--success-color);
    animation: correctPulse 0.5s ease;
}

.current-word.incorrect {
    color: var(--danger-color);
    animation: shake 0.5s ease;
}

@keyframes correctPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

/* 输入区域 */
.input-area {
    margin-bottom: 30px;
}

#typingInput {
    width: 100%;
    padding: 20px;
    font-size: 24px;
    font-family: 'Poppins', monospace;
    border: 3px solid var(--secondary-color);
    border-radius: 10px;
    text-align: center;
    transition: var(--transition);
    margin-bottom: 15px;
}

#typingInput:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.3);
}

#typingInput:disabled {
    background-color: #f5f5f5;
    cursor: not-allowed;
}

.input-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    color: var(--gray-color);
    font-weight: 500;
}

.stat-item i {
    color: var(--primary-color);
}

.stat-item span {
    font-weight: 700;
    color: var(--dark-color);
}

/* 进度条 */
.progress-container {
    margin-bottom: 30px;
}

.progress-bar {
    height: 20px;
    background: linear-gradient(90deg, var(--success-color), var(--primary-color));
    border-radius: 10px;
    width: 0%;
    transition: width 0.3s ease;
    position: relative;
    overflow: hidden;
}

.progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(255, 255, 255, 0.3) 50%, 
        transparent 100%);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.progress-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 12px;
    color: var(--gray-color);
}

/* 下一个单词预览 */
.next-word-preview {
    background-color: #f8f9fa;
    padding: 15px 20px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.preview-label {
    font-weight: 500;
    color: var(--gray-color);
}

.next-word {
    font-family: 'Poppins', monospace;
    font-weight: 600;
    color: var(--dark-color);
    font-size: 18px;
    opacity: 0.7;
}

/* 游戏侧边栏 */
.game-sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.game-instructions,
.word-list-container,
.scoring-info {
    background-color: white;
    padding: 25px;
    border-radius: 15px;
    box-shadow: var(--shadow);
}

.game-instructions h3,
.word-list-container h3,
.scoring-info h4 {
    font-size: 20px;
    color: var(--dark-color);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.game-instructions ul {
    list-style: none;
}

.game-instructions li {
    padding: 8px 0;
    border-bottom: 1px solid #eee;
    color: var(--gray-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.game-instructions li:last-child {
    border-bottom: none;
}

.game-instructions li i {
    color: var(--primary-color);
    width: 20px;
}

/* 单词列表 */
.word-list {
    max-height: 200px;
    overflow-y: auto;
    padding-right: 10px;
}

.word-list::-webkit-scrollbar {
    width: 6px;
}

.word-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.word-list::-webkit-scrollbar-thumb {
    background: var(--secondary-color);
    border-radius: 3px;
}

.word-item {
    padding: 10px 15px;
    margin-bottom: 8px;
    background-color: #f8f9fa;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
}

.word-item:hover {
    transform: translateX(5px);
    background-color: #eef2ff;
}

.word-item.correct {
    border-left: 4px solid var(--success-color);
}

.word-item.incorrect {
    border-left: 4px solid var(--danger-color);
}

.word-text {
    font-family: 'Poppins', monospace;
    font-weight: 500;
}

.word-status {
    font-size: 12px;
    padding: 3px 8px;
    border-radius: 12px;
    font-weight: 500;
}

.word-status.correct {
    background-color: rgba(0, 184, 148, 0.1);
    color: var(--success-color);
}

.word-status.incorrect {
    background-color: rgba(214, 48, 49, 0.1);
    color: var(--danger-color);
}

/* 计分规则 */
.scoring-info {
    background: linear-gradient(135deg, #f8f9fa 0%, #eef2ff 100%);
}

.score-rule {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #e0e0e0;
}

.score-rule:last-child {
    border-bottom: none;
}

.rule-label {
    color: var(--gray-color);
    font-size: 14px;
}

.rule-value {
    font-weight: 600;
    color: var(--primary-color);
    font-size: 14px;
}

/* 游戏结果 */
.game-result {
    background-color: white;
    padding: 40px;
    border-radius: 15px;
    box-shadow: var(--shadow);
    text-align: center;
}

.result-content {
    max-width: 800px;
    margin: 0 auto;
}

.result-content h2 {
    font-size: 36px;
    color: var(--primary-color);
    margin-bottom: 30px;
}

.result-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.result-stat {
    background-color: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
}

.result-label {
    display: block;
    font-size: 14px;
    color: var(--gray-color);
    margin-bottom: 8px;
}

.result-value {
    display: block;
    font-size: 28px;
    font-weight: 700;
    color: var(--primary-color);
}

#rank {
    color: var(--accent-color);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.result-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .game-area {
        grid-template-columns: 1fr;
    }
    
    .game-sidebar {
        order: -1;
    }
}

@media (max-width: 768px) {
    .game-header h1 {
        font-size: 28px;
    }
    
    .game-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .stat-value {
        font-size: 24px;
    }
    
    .current-word {
        font-size: 36px;
    }
    
    #typingInput {
        font-size: 20px;
        padding: 15px;
    }
    
    .game-controls {
        flex-direction: column;
    }
    
    .difficulty-select {
        width: 100%;
        max-width: 300px;
    }
    
    .result-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .game-stats {
        grid-template-columns: 1fr;
    }
    
    .current-word {
        font-size: 28px;
    }
    
    #typingInput {
        font-size: 18px;
    }
    
    .result-stats {
        grid-template-columns: 1fr;
    }
    
    .result-actions {
        flex-direction: column;
    }
    
    .result-actions .btn {
        width: 100%;
    }
}

/* 键盘焦点样式 */
#typingInput:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* 游戏状态指示器 */
.game-status {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 10px 20px;
    border-radius: 20px;
    font-weight: 500;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.game-status.playing {
    background-color: var(--success-color);
    color: white;
}

.game-status.paused {
    background-color: var(--warning-color);
    color: var(--dark-color);
}

.game-status.ended {
    background-color: var(--danger-color);
    color: white;
}