/* ==================== 虚拟键盘样式 ==================== */

/* 键盘模式页面 */
#keyboard-mode-page {
    background: linear-gradient(135deg, #0a0a1a 0%, #1a1a2e 50%, #0f0f23 100%);
}

.keyboard-mode-container {
    max-width: 1200px;
    width: 100%;
    padding: 20px;
}

.keyboard-mode-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.keyboard-mode-header h2 {
    font-size: 1.8rem;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.back-btn {
    padding: 10px 25px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--primary-color);
    border-radius: 25px;
    color: var(--primary-color);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.back-btn:hover {
    background: rgba(108, 92, 231, 0.2);
    transform: translateY(-2px);
}

/* 键盘模式显示区域 */
.keyboard-display-area {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 30px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.typed-text {
    font-size: 2rem;
    font-family: 'Courier New', monospace;
    letter-spacing: 3px;
    color: var(--text-color);
    word-break: break-all;
    text-align: center;
    line-height: 1.6;
}

.typed-text .char-correct {
    color: var(--success-color);
}

.typed-text .char-error {
    color: var(--error-color);
    text-decoration: underline;
}

.typed-text .cursor {
    display: inline-block;
    width: 3px;
    height: 2rem;
    background: var(--primary-color);
    margin-left: 2px;
    animation: cursorBlink 1s infinite;
    vertical-align: middle;
}

@keyframes cursorBlink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* 虚拟键盘容器 */
.virtual-keyboard {
    background: linear-gradient(145deg, #1e1e30, #151525);
    border-radius: 20px;
    padding: 25px;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

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

.keyboard-row:last-child {
    margin-bottom: 0;
}

/* 单个按键 */
.vk-key {
    position: relative;
    width: 50px;
    height: 50px;
    background: linear-gradient(145deg, #2a2a40, #1a1a2a);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    box-shadow: 
        0 4px 8px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.key-label {
    font-size: 14px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.8);
    text-transform: uppercase;
    z-index: 2;
    transition: all 0.15s ease;
}

.key-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: radial-gradient(circle, var(--primary-color) 0%, transparent 70%);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1;
}

/* 按键激活状态 */
.vk-key.active {
    transform: translateY(2px) scale(0.98);
    background: linear-gradient(145deg, var(--primary-color), var(--secondary-color));
    border-color: var(--primary-color);
    box-shadow: 
        0 2px 4px rgba(0, 0, 0, 0.3),
        0 0 20px rgba(108, 92, 231, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.vk-key.active .key-label {
    color: white;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.vk-key.active .key-glow {
    width: 100px;
    height: 100px;
    opacity: 0.5;
}

/* 按键提示状态（下一个要按的键） */
.vk-key.hint {
    animation: hintPulse 1s infinite;
    border-color: var(--accent-color);
}

@keyframes hintPulse {
    0%, 100% {
        box-shadow: 
            0 4px 8px rgba(0, 0, 0, 0.3),
            0 0 10px rgba(253, 121, 168, 0.3);
    }
    50% {
        box-shadow: 
            0 4px 8px rgba(0, 0, 0, 0.3),
            0 0 25px rgba(253, 121, 168, 0.6);
    }
}

/* 波纹效果 */
.key-ripple {
    position: absolute;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.4) 0%, transparent 70%);
    border-radius: 8px;
    animation: rippleEffect 0.3s ease-out;
    z-index: 3;
}

@keyframes rippleEffect {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    100% {
        transform: scale(2);
        opacity: 0;
    }
}

/* 特殊键宽度 */
.key-small {
    width: 55px;
}

.key-medium {
    width: 75px;
}

.key-wide {
    width: 95px;
}

.key-space {
    width: 300px;
}

/* 手指颜色指示 */
.finger-pinky-left { --finger-color: #e74c3c; }
.finger-ring-left { --finger-color: #e67e22; }
.finger-middle-left { --finger-color: #f1c40f; }
.finger-index-left { --finger-color: #2ecc71; }
.finger-index-right { --finger-color: #1abc9c; }
.finger-middle-right { --finger-color: #3498db; }
.finger-ring-right { --finger-color: #9b59b6; }
.finger-pinky-right { --finger-color: #e91e63; }
.finger-thumb { --finger-color: #00bcd4; }

.vk-key::after {
    content: '';
    position: absolute;
    bottom: 3px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 3px;
    background: var(--finger-color, transparent);
    border-radius: 2px;
    opacity: 0.6;
}

/* 键盘模式统计 */
.keyboard-stats {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-top: 25px;
    padding: 20px;
    background: var(--card-bg);
    border-radius: 15px;
}

.kb-stat {
    text-align: center;
}

.kb-stat-value {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--primary-color);
}

.kb-stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 5px;
}

/* 键盘模式提示 */
.keyboard-mode-hint {
    text-align: center;
    margin-top: 20px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ==================== 响应式设计 ==================== */
@media (max-width: 900px) {
    .virtual-keyboard {
        padding: 15px;
        transform: scale(0.85);
        transform-origin: center top;
    }
    
    .vk-key {
        width: 40px;
        height: 40px;
    }
    
    .key-label {
        font-size: 11px;
    }
    
    .key-small { width: 45px; }
    .key-medium { width: 60px; }
    .key-wide { width: 75px; }
    .key-space { width: 200px; }
}

@media (max-width: 600px) {
    .virtual-keyboard {
        transform: scale(0.65);
    }
    
    .keyboard-display-area {
        min-height: 80px;
        padding: 20px;
    }
    
    .typed-text {
        font-size: 1.5rem;
    }
    
    .keyboard-stats {
        flex-wrap: wrap;
        gap: 20px;
    }
}
