/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 控制面板样式 */
.control-panel {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.controls-left, .controls-center, .controls-right {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

/* 按钮样式 */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-primary {
    background: linear-gradient(45deg, #4CAF50, #45a049);
    color: white;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
}

.btn-secondary {
    background: linear-gradient(45deg, #6c757d, #5a6268);
    color: white;
    box-shadow: 0 4px 15px rgba(108, 117, 125, 0.3);
}

.btn-secondary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(108, 117, 125, 0.4);
}

.btn-outline {
    background: transparent;
    color: #667eea;
    border: 2px solid #667eea;
}

.btn-outline:hover {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
}

.btn-small {
    padding: 8px 16px;
    font-size: 12px;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* 选择器和输入框样式 */
select, input[type="text"], input[type="number"] {
    padding: 10px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s ease;
    background: white;
}

select:focus, input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

label {
    font-weight: 600;
    color: #555;
    margin-right: 10px;
}

/* 主内容区域 */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* 键盘区域 */
.keyboard-section {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
}

.keyboard-container {
    width: 100%;
    max-width: 1000px;
    display: flex;
    justify-content: center;
}

.keyboard {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-family: 'Courier New', monospace;
}

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

.key {
    min-width: 50px;
    height: 50px;
    background: linear-gradient(145deg, #f0f0f0, #e0e0e0);
    border: 2px solid #d0d0d0;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    user-select: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.key:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* 特殊键位样式 */
.key.space {
    min-width: 300px;
}

.key.tab, .key.caps-lock, .key.shift, .key.ctrl, .key.alt, .key.meta {
    background: linear-gradient(145deg, #e8e8e8, #d8d8d8);
    font-size: 12px;
}

.key.enter, .key.backspace {
    background: linear-gradient(145deg, #e8e8e8, #d8d8d8);
    min-width: 80px;
}

/* 按键状态样式 */
.key.pressed {
    background: linear-gradient(145deg, #4CAF50, #45a049);
    color: white;
    transform: scale(0.95);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.key.target {
    background: linear-gradient(145deg, #ff6b6b, #ee5a52);
    color: white;
    animation: pulse 1.5s infinite;
    box-shadow: 0 0 20px rgba(255, 107, 107, 0.5);
}

.key.error {
    background: linear-gradient(145deg, #ff4757, #ff3742);
    color: white;
    animation: shake 0.5s ease-in-out;
}

.key.combo-target {
    background: linear-gradient(145deg, #ffa726, #ff9800);
    color: white;
    animation: glow 2s infinite;
    box-shadow: 0 0 25px rgba(255, 167, 38, 0.6);
}

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

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

@keyframes glow {
    0%, 100% { box-shadow: 0 0 25px rgba(255, 167, 38, 0.6); }
    50% { box-shadow: 0 0 35px rgba(255, 167, 38, 0.8); }
}

/* 目标显示区域 */
.target-display {
    text-align: center;
    padding: 20px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 15px;
    color: white;
    min-width: 300px;
}

.target-label {
    font-size: 16px;
    margin-bottom: 10px;
    opacity: 0.9;
    color: white;
}

.target-key {
    font-size: 32px;
    font-weight: bold;
    margin-bottom: 5px;
    color: #FF8C00; /* 橙色文字 */
    text-shadow: 0 0 10px rgba(255, 140, 0, 0.5), 0 2px 4px rgba(0, 0, 0, 0.3); /* 橙色发光效果 + 原有阴影 */
}

.target-case {
    font-size: 16px;
    margin-bottom: 10px;
    opacity: 0.8;
    font-style: italic;
    color: white !important;
}

/* 目标反馈文本显示 */
.target-feedback {
    margin-top: 15px;
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    font-weight: bold;
    font-size: 16px;
    transition: all 0.3s ease;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(255, 255, 255, 0.1);
    border: 2px solid transparent;
    color: rgba(255, 255, 255, 0.7);
}

.target-feedback.correct {
    background-color: rgba(76, 175, 80, 0.8) !important;
    border: 3px solid #4CAF50 !important;
    color: white !important;
    font-weight: bold !important;
    font-size: 18px !important;
    animation: feedbackPulse 0.3s ease-out;
    z-index: 1000;
    position: relative;
}

.target-feedback.error {
    background-color: rgba(244, 67, 54, 0.8) !important;
    border: 3px solid #F44336 !important;
    color: white !important;
    font-weight: bold !important;
    font-size: 18px !important;
    animation: feedbackPulse 0.3s ease-out;
    z-index: 1000;
    position: relative;
}

.feedback-text {
    line-height: 1.4;
    min-height: 20px;
    color: inherit !important;
    font-weight: inherit !important;
    font-size: inherit !important;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

@keyframes feedbackPulse {
    0% { 
        transform: scale(1);
    }
    50% { 
        transform: scale(1.02);
    }
    100% { 
        transform: scale(1);
    }
}

/* 目标显示区域反馈状态 */
.target-display.correct {
    background: linear-gradient(135deg, #4CAF50, #45a049) !important;
    border: 4px solid #2E7D32 !important;
    box-shadow: 0 0 30px rgba(76, 175, 80, 0.6) !important;
    transform: scale(1.02);
    transition: all 0.3s ease;
}

.target-display.error {
    background: linear-gradient(135deg, #F44336, #d32f2f) !important;
    border: 4px solid #C62828 !important;
    box-shadow: 0 0 30px rgba(244, 67, 54, 0.6) !important;
    transform: scale(1.02);
    transition: all 0.3s ease;
}

.target-timer {
    font-size: 18px;
    opacity: 0.8;
    color: white;
}

/* 统计面板 */
.stats-panel {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 20px;
}

.stat-item {
    text-align: center;
    min-width: 120px;
}

.stat-label {
    font-size: 14px;
    color: #666;
    margin-bottom: 8px;
    font-weight: 600;
}

.stat-value {
    font-size: 28px;
    font-weight: bold;
    color: #333;
    margin-bottom: 4px;
}

.stat-unit {
    font-size: 12px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* 设置面板 */
.settings-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.settings-content {
    background: white;
    border-radius: 15px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.settings-content h3 {
    margin-bottom: 25px;
    color: #333;
    text-align: center;
    font-size: 24px;
}

.setting-group {
    margin-bottom: 25px;
}

.setting-group h4 {
    margin-bottom: 15px;
    color: #555;
    font-size: 16px;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 8px;
}

.setting-item {
    margin-bottom: 15px;
}

.setting-item label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: normal;
    margin: 0;
}

.setting-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #667eea;
}

.setting-item input[type="text"] {
    width: 100%;
    margin-top: 5px;
}

.custom-combos {
    margin-top: 10px;
}

.combo-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 6px;
    margin-bottom: 8px;
}

.combo-item button {
    padding: 4px 8px;
    font-size: 12px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.settings-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 30px;
}


/* 结果面板 */
.result-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.result-content {
    background: white;
    border-radius: 15px;
    padding: 30px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    text-align: center;
}

.result-content h3 {
    margin-bottom: 25px;
    color: #4CAF50;
    font-size: 28px;
}

.result-stats {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 25px;
}

.result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

.result-label {
    font-weight: 600;
    color: #555;
}

.result-value {
    font-size: 20px;
    font-weight: bold;
    color: #333;
}

.result-unit {
    font-size: 14px;
    color: #888;
    margin-left: 5px;
}

.weakness-analysis {
    text-align: left;
    margin-bottom: 25px;
}

.weakness-analysis h4 {
    margin-bottom: 15px;
    color: #555;
    text-align: center;
}

.weakness-item {
    padding: 10px;
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    margin-bottom: 8px;
    border-radius: 4px;
}

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

/* 五笔模式样式 */
.keyboard-mode-selector {
    margin-left: 20px;
}

.keyboard-mode-selector label {
    margin-right: 10px;
    font-weight: bold;
    color: #333;
}

.mode-buttons {
    display: inline-flex;
    border: 1px solid #ddd;
    border-radius: 5px;
    overflow: hidden;
}

.mode-btn {
    padding: 8px 16px;
    border: none;
    background: #f8f9fa;
    color: #333;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    border-right: 1px solid #ddd;
}

.mode-btn:last-child {
    border-right: none;
}

.mode-btn:hover {
    background: #e9ecef;
}

.mode-btn.active {
    background: #007bff;
    color: white;
}

/* 五笔键盘样式 */
.wubi-keyboard .key {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    padding: 8px 4px;
    font-size: 8px;
    line-height: 1.0;
    min-height: 100px;
    width: 85px;
    margin: 3px;
}

.wubi-keyboard .key .key-letter {
    font-size: 14px;
    font-weight: bold;
    color: #333;
    margin-bottom: 2px;
    flex-shrink: 0;
}

.wubi-keyboard .key .key-roots {
    font-size: 11px;
    font-weight: bold;
    color: #d32f2f;
    text-align: center;
    line-height: 1.4;
    flex-grow: 1;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    word-spacing: 3px;
    letter-spacing: 1px;
    max-width: 100%;
    overflow: visible;
    padding: 6px 3px;
    min-height: 45px;
}

.wubi-keyboard .key .key-name {
    font-size: 7px;
    color: #666;
    margin-top: 1px;
    text-align: center;
    opacity: 0.8;
    flex-shrink: 0;
    max-width: 100%;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    line-height: 1.1;
}

/* 五笔键位层级颜色 */
.wubi-keyboard .key.horizontal-layer {
    background: linear-gradient(135deg, #e8f5e8, #c8e6c9);
    border-color: #4CAF50;
}

.wubi-keyboard .key.vertical-layer {
    background: linear-gradient(135deg, #e3f2fd, #bbdefb);
    border-color: #2196F3;
}

.wubi-keyboard .key.left-stroke-layer {
    background: linear-gradient(135deg, #fff3e0, #ffcc02);
    border-color: #FF9800;
}

.wubi-keyboard .key.dot-stroke-layer {
    background: linear-gradient(135deg, #f3e5f5, #e1bee7);
    border-color: #9C27B0;
}

.wubi-keyboard .key.fold-stroke-layer {
    background: linear-gradient(135deg, #fce4ec, #f8bbd9);
    border-color: #E91E63;
}

/* 五笔目标显示样式 */
.wubi-mode .target-key {
    font-family: 'Microsoft YaHei', '微软雅黑', SimSun, serif;
    font-size: 36px;
    color: #FF8C00;
    text-shadow: 0 0 15px rgba(255, 140, 0, 0.6), 0 2px 4px rgba(0, 0, 0, 0.3);
}

.wubi-mode .target-case {
    color: white !important;
    font-weight: bold;
}

/* 五笔字根高亮效果 */
.wubi-keyboard .key.target {
    background: linear-gradient(135deg, #ffeb3b, #ffc107) !important;
    border: 3px solid #ff9800 !important;
    box-shadow: 0 0 20px rgba(255, 193, 7, 0.6);
    transform: scale(1.05);
}

.wubi-keyboard .key.pressed {
    background: linear-gradient(135deg, #4caf50, #45a049) !important;
    border: 2px solid #2e7d32 !important;
    transform: scale(0.95);
}

.wubi-keyboard .key.error {
    background: linear-gradient(135deg, #f44336, #d32f2f) !important;
    border: 2px solid #c62828 !important;
    animation: errorShake 0.5s ease-in-out;
}

/* 五笔详细信息弹窗 */
.wubi-detail-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease-out;
}

.wubi-detail-content {
    background: white;
    border-radius: 10px;
    padding: 0;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease-out;
}

.wubi-detail-header {
    background: linear-gradient(135deg, #2196F3, #1976D2);
    color: white;
    padding: 20px;
    border-radius: 10px 10px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.wubi-detail-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: bold;
}

.close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background 0.3s ease;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.wubi-detail-body {
    padding: 20px;
    line-height: 1.6;
}

.wubi-detail-body p {
    margin: 15px 0;
    color: #333;
}

.wubi-detail-body strong {
    color: #2196F3;
    font-weight: bold;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .control-panel {
        flex-direction: column;
        gap: 15px;
    }
    
    .controls-left, .controls-center, .controls-right {
        justify-content: center;
        width: 100%;
    }
    
    .keyboard-section {
        padding: 20px;
    }
    
    .key {
        min-width: 40px;
        height: 40px;
        font-size: 12px;
    }
    
    .key.space {
        min-width: 200px;
    }
    
    .stats-panel {
        flex-direction: column;
        gap: 15px;
    }
    
    .stat-item {
        min-width: auto;
    }
    
    .target-key {
        font-size: 24px;
    }
}

@media (max-width: 480px) {
    .key {
        min-width: 35px;
        height: 35px;
        font-size: 10px;
    }
    
    .key.space {
        min-width: 150px;
    }
    
    .btn {
        padding: 10px 16px;
        font-size: 12px;
    }
    
    .target-key {
        font-size: 20px;
    }
}