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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: 
        radial-gradient(circle at 20% 80%, rgba(120, 119, 198, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 119, 198, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(120, 219, 255, 0.2) 0%, transparent 50%),
        linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    color: #333;
    position: relative;
    overflow-x: hidden;
}

/* 添加动态背景纹理 */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(circle at 1px 1px, rgba(255, 255, 255, 0.15) 1px, transparent 0);
    background-size: 20px 20px;
    pointer-events: none;
    z-index: -1;
}

/* 添加顶部光晕效果 */
body::after {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(ellipse at center, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    pointer-events: none;
    z-index: -2;
    animation: float 20s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(1deg); }
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 40px;
    color: #2c3e50;
    position: relative;
    z-index: 1;
}

header h1 {
    font-size: 2.8rem;
    margin-bottom: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 800;
    text-shadow: none;
    letter-spacing: -0.5px;
}

header p {
    font-size: 1.3rem;
    color: #5a6c7d;
    font-weight: 500;
    opacity: 1;
}

.test-area {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 40px;
}

.key-display {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 35px;
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.08),
        0 8px 16px rgba(0, 0, 0, 0.06),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    grid-column: 1 / -1;
    border: 1px solid rgba(255, 255, 255, 0.3);
    position: relative;
    overflow: hidden;
}

.key-display::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.8), transparent);
}

.current-key {
    text-align: center;
    margin-bottom: 30px;
    padding: 45px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px;
    color: white;
    position: relative;
    overflow: hidden;
    box-shadow: 
        0 20px 40px rgba(102, 126, 234, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.current-key::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at center, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {
    0%, 100% { transform: translateX(-100%) translateY(-100%) rotate(0deg); }
    50% { transform: translateX(100%) translateY(100%) rotate(180deg); }
}

.key-label {
    font-size: 2rem;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

.key-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    border-left: 4px solid #667eea;
}

.info-item .label {
    font-weight: 600;
    color: #666;
}

.info-item .value {
    font-family: 'Courier New', monospace;
    font-weight: bold;
    color: #333;
    background: white;
    padding: 5px 10px;
    border-radius: 5px;
    border: 1px solid #ddd;
}

.virtual-keyboard {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.08),
        0 8px 16px rgba(0, 0, 0, 0.06),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.3);
    position: relative;
}

.virtual-keyboard h3 {
    margin-bottom: 20px;
    color: #333;
    text-align: center;
}

.keyboard-layout {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.keyboard-row {
    display: flex;
    justify-content: center;
    gap: 5px;
}

.key {
    padding: 10px 14px;
    background: linear-gradient(145deg, #f8f9fa, #e9ecef);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #5a6c7d;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 44px;
    text-align: center;
    user-select: none;
    box-shadow: 
        0 2px 4px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    position: relative;
    overflow: hidden;
}

.key:hover {
    background: linear-gradient(145deg, #e9ecef, #dee2e6);
    transform: translateY(-3px) scale(1.02);
    box-shadow: 
        0 8px 16px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.key.active {
    background: linear-gradient(145deg, #667eea, #5a6fd8);
    color: white;
    border-color: #667eea;
    transform: translateY(-2px) scale(0.98);
    box-shadow: 
        0 8px 20px rgba(102, 126, 234, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.key.special {
    background: linear-gradient(145deg, #ffd43b, #fcc419);
    border-color: #fcc419;
    color: #333;
    box-shadow: 
        0 2px 4px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.key.special.active {
    background: linear-gradient(145deg, #fcc419, #f39c12);
    color: white;
    box-shadow: 
        0 8px 20px rgba(252, 196, 25, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.key-spacer {
    min-width: 40px;
    height: 40px;
    /* 透明背景，用于布局对齐 */
}

.key-history {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.08),
        0 8px 16px rgba(0, 0, 0, 0.06),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.3);
    position: relative;
}

.key-history h3 {
    margin-bottom: 20px;
    color: #333;
    text-align: center;
}

.history-list {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 20px;
}

.history-item {
    padding: 10px 15px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 8px;
    border-left: 4px solid #28a745;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
}

.clear-btn {
    width: 100%;
    padding: 12px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s ease;
}

.clear-btn:hover {
    background: #c82333;
}

.test-results {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 35px;
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.08),
        0 8px 16px rgba(0, 0, 0, 0.06),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    margin-bottom: 40px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    position: relative;
}

.test-results h3 {
    margin-bottom: 25px;
    color: #333;
    text-align: center;
}

.result-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.result-item {
    text-align: center;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    color: white;
}

.result-label {
    display: block;
    font-size: 0.9rem;
    opacity: 0.9;
    margin-bottom: 8px;
}

.result-value {
    display: block;
    font-size: 2rem;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}



footer {
    text-align: center;
    color: #5a6c7d;
    font-size: 1rem;
    font-weight: 500;
    position: relative;
    z-index: 1;
}

/* 打字练习模块样式 */
.typing-practice {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 35px;
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.08),
        0 8px 16px rgba(0, 0, 0, 0.06),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    margin-bottom: 40px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    position: relative;
}

.typing-practice h3 {
    margin-bottom: 25px;
    color: #333;
    text-align: center;
    font-size: 1.5rem;
}

.typing-container {
    display: grid;
    gap: 25px;
}

.typing-text-display {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 15px;
    padding: 25px;
    font-size: 1.1rem;
    line-height: 1.6;
    color: #495057;
    font-family: 'Georgia', serif;
    min-height: 120px;
    display: flex;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.typing-text-display::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, #667eea, transparent);
}

.typing-input-area {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.typing-input-area textarea {
    width: 100%;
    padding: 20px;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    font-size: 1rem;
    line-height: 1.5;
    font-family: 'Courier New', monospace;
    resize: vertical;
    transition: all 0.3s ease;
    background: white;
}

.typing-input-area textarea:focus {
    outline: none;
    border-color: #333;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.1);
}

.typing-input-area textarea:disabled {
    background: #f8f9fa;
    color: #6c757d;
    cursor: not-allowed;
}

.typing-controls {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.start-btn, .reset-btn, .new-text-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
}

.start-btn {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
}

.start-btn:hover {
    background: linear-gradient(135deg, #218838, #1ea085);
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(40, 167, 69, 0.3);
}

.pause-btn {
    background: linear-gradient(135deg, #6c757d, #495057);
    color: white;
}

.pause-btn:hover {
    background: linear-gradient(135deg, #5a6268, #343a40);
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(108, 117, 125, 0.3);
}

.reset-btn {
    background: linear-gradient(135deg, #ffc107, #fd7e14);
    color: white;
}

.reset-btn:hover {
    background: linear-gradient(135deg, #e0a800, #e8590c);
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(255, 193, 7, 0.3);
}

.new-text-btn {
    background: linear-gradient(135deg, #17a2b8, #6f42c1);
    color: white;
}

.new-text-btn:hover {
    background: linear-gradient(135deg, #138496, #5a32a3);
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(23, 162, 184, 0.3);
}

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

.stat-item {
    background: linear-gradient(135deg, #2c3e50 0%, #1a1a1a 100%);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    color: white;
    position: relative;
    overflow: hidden;
}

.stat-item::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at center, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    animation: float 15s ease-in-out infinite;
}

.stat-label {
    display: block;
    font-size: 0.9rem;
    opacity: 0.9;
    margin-bottom: 8px;
}

.stat-value {
    display: block;
    font-size: 1.8rem;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .typing-controls {
        flex-direction: column;
        align-items: center;
    }
    
    .start-btn, .reset-btn, .new-text-btn {
        width: 100%;
        max-width: 200px;
    }
    
    .typing-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .typing-stats {
        grid-template-columns: 1fr;
    }
    
    .typing-text-display {
        font-size: 1rem;
        padding: 20px;
    }
}

/* 头部操作按钮样式 */
.header-actions {
    margin-top: 20px;
    text-align: center;
}

.typing-practice-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 25px;
    padding: 12px 30px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.typing-practice-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

/* 模态弹窗样式 */
.typing-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease;
}

.typing-modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.typing-modal-content {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    border-radius: 25px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 
        0 25px 50px rgba(0, 0, 0, 0.15),
        0 15px 30px rgba(0, 0, 0, 0.1);
    animation: slideIn 0.3s ease;
    position: relative;
}

.typing-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px 30px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    background: linear-gradient(135deg, #2c3e50 0%, #1a1a1a 100%);
    color: white;
    border-radius: 25px 25px 0 0;
}

.typing-modal-header h2 {
    margin: 0;
    font-size: 1.8rem;
    font-weight: 700;
}

.close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 2rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.typing-modal-body {
    padding: 30px;
}

/* 模态弹窗内的打字练习样式调整 */
.typing-modal .typing-practice {
    background: none;
    box-shadow: none;
    border: none;
    padding: 0;
    margin: 0;
}

.typing-modal .typing-practice h3 {
    display: none;
}

/* 动画效果 */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from { 
        transform: translateY(-50px) scale(0.9);
        opacity: 0;
    }
    to { 
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

/* 响应式模态弹窗 */
@media (max-width: 768px) {
    .typing-modal-content {
        width: 95%;
        margin: 20px;
    }
    
    .typing-modal-header {
        padding: 20px 25px;
    }
    
    .typing-modal-header h2 {
        font-size: 1.5rem;
    }
    
    .typing-modal-body {
        padding: 20px;
    }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .test-area {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .key-info {
        grid-template-columns: 1fr;
    }
    
    .result-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .key-label {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 15px;
    }
    
    .key-display {
        padding: 20px;
    }
    
    .current-key {
        padding: 25px;
    }
    
    .result-grid {
        grid-template-columns: 1fr;
    }
}

/* 滚动条样式 */
.history-list::-webkit-scrollbar {
    width: 8px;
}

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

.history-list::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.history-list::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* 动画效果 */
@keyframes keyPress {
    0% { transform: scale(1); }
    50% { transform: scale(0.95); }
    100% { transform: scale(1); }
}

.key-press-animation {
    animation: keyPress 0.1s ease-in-out;
}

/* 打字练习文本显示优化 */
.typing-text-display {
    font-family: 'Courier New', monospace;
    font-size: 1.1rem;
    line-height: 1.8;
    letter-spacing: 0.5px;
}

.char-correct {
    color: #28a745;
}

.char-incorrect {
    color: #dc3545;
    background-color: rgba(220, 53, 69, 0.1);
    border-radius: 2px;
}

.char-pending {
    color: #333;
}
