/* 基础重置和变量 */ * { margin: 0; padding: 0; box-sizing: border-box; } :root { /* 日间模式颜色 */ --bg-primary: #ffffff; --bg-secondary: #f8f9fa; --bg-tertiary: #e9ecef; --text-primary: #212529; --text-secondary: #6c757d; --text-accent: #0066cc; --border-color: #dee2e6; --shadow-light: 0 2px 4px rgba(0,0,0,0.1); --shadow-medium: 0 4px 8px rgba(0,0,0,0.15); --shadow-heavy: 0 8px 16px rgba(0,0,0,0.2); --key-bg: #ffffff; --key-border: #d1d5db; --key-active: #3b82f6; --key-pressed: #1d4ed8; --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%); --gradient-secondary: linear-gradient(135deg, #f093fb 0%, #f5576c 100%); } [data-theme="dark"] { /* 夜间模式颜色 */ --bg-primary: #1a1a1a; --bg-secondary: #2d2d2d; --bg-tertiary: #404040; --text-primary: #ffffff; --text-secondary: #b3b3b3; --text-accent: #4da6ff; --border-color: #555555; --shadow-light: 0 2px 4px rgba(0,0,0,0.3); --shadow-medium: 0 4px 8px rgba(0,0,0,0.4); --shadow-heavy: 0 8px 16px rgba(0,0,0,0.5); --key-bg: #2d2d2d; --key-border: #555555; --key-active: #4da6ff; --key-pressed: #0066cc; --gradient-primary: linear-gradient(135deg, #4a5568 0%, #2d3748 100%); --gradient-secondary: linear-gradient(135deg, #667eea 0%, #764ba2 100%); } body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif; line-height: 1.6; color: var(--text-primary); background-color: var(--bg-primary); transition: all 0.3s ease; } .container { max-width: 1200px; margin: 0 auto; padding: 0 20px; } /* 主题切换按钮 */ .theme-toggle { position: fixed; top: 20px; right: 20px; z-index: 1000; width: 50px; height: 50px; background: var(--gradient-primary); border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: var(--shadow-medium); transition: all 0.3s ease; } .theme-toggle:hover { transform: scale(1.1); box-shadow: var(--shadow-heavy); } .theme-icon { font-size: 24px; transition: transform 0.3s ease; } /* 滚动按钮 */ .scroll-buttons { position: fixed; right: 20px; bottom: 20px; z-index: 1000; display: flex; flex-direction: column; gap: 10px; } .scroll-btn { width: 50px; height: 50px; border: none; border-radius: 50%; background: var(--gradient-secondary); color: white; font-size: 20px; font-weight: bold; cursor: pointer; box-shadow: var(--shadow-medium); transition: all 0.3s ease; } .scroll-btn:hover { transform: scale(1.1); box-shadow: var(--shadow-heavy); } /* 通知提示 */ .notification { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); background: var(--bg-secondary); color: var(--text-primary); padding: 20px 30px; border-radius: 10px; box-shadow: var(--shadow-heavy); z-index: 2000; opacity: 0; visibility: hidden; transition: all 0.3s ease; max-width: 400px; text-align: center; border: 1px solid var(--border-color); } .notification.show { opacity: 1; visibility: visible; } /* 头部导航 */ .header { background: var(--bg-primary); box-shadow: var(--shadow-light); position: sticky; top: 0; z-index: 100; border-bottom: 1px solid var(--border-color); } .navbar { padding: 1rem 0; } .nav-container { display: flex; justify-content: space-between; align-items: center; max-width: 1200px; margin: 0 auto; padding: 0 20px; } .logo { display: flex; align-items: center; gap: 10px; font-size: 1.5rem; font-weight: bold; color: var(--text-primary); text-decoration: none; } .logo-icon { font-size: 2rem; background: var(--gradient-primary); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; } .nav-menu { display: flex; list-style: none; gap: 2rem; align-items: center; } .nav-item { position: relative; } .nav-link { color: var(--text-primary); text-decoration: none; font-weight: 500; transition: color 0.3s ease; padding: 0.5rem 0; } .nav-link:hover { color: var(--text-accent); } .dropdown { position: relative; } .dropdown-menu { position: absolute; top: 100%; left: 0; background: var(--bg-primary); border: 1px solid var(--border-color); border-radius: 8px; box-shadow: var(--shadow-medium); list-style: none; padding: 0.5rem 0; min-width: 200px; opacity: 0; visibility: hidden; transform: translateY(-10px); transition: all 0.3s ease; z-index: 1000; } .dropdown:hover .dropdown-menu { opacity: 1; visibility: visible; transform: translateY(0); } .dropdown-menu li { padding: 0; } .dropdown-menu a { display: block; padding: 0.75rem 1rem; color: var(--text-primary); text-decoration: none; transition: background-color 0.3s ease; } .dropdown-menu a:hover { background-color: var(--bg-secondary); color: var(--text-accent); } .nav-actions { display: flex; gap: 1rem; align-items: center; } .action-btn { display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem 1rem; border: 1px solid var(--border-color); border-radius: 6px; background: var(--bg-secondary); color: var(--text-primary); text-decoration: none; font-weight: 500; transition: all 0.3s ease; cursor: pointer; } .action-btn:hover { background: var(--text-accent); color: white; transform: translateY(-2px); box-shadow: var(--shadow-medium); } .hamburger { display: none; flex-direction: column; cursor: pointer; gap: 4px; } .hamburger span { width: 25px; height: 3px; background: var(--text-primary); transition: all 0.3s ease; } /* 主要内容区域 */ .main-content { min-height: calc(100vh - 200px); } .hero-section { background: var(--gradient-primary); color: white; padding: 4rem 0; text-align: center; } .hero-title { font-size: 3rem; font-weight: bold; margin-bottom: 1rem; text-shadow: 2px 2px 4px rgba(0,0,0,0.3); } .hero-subtitle { font-size: 1.2rem; opacity: 0.9; max-width: 600px; margin: 0 auto; } /* 键盘测试区域 */ .keyboard-section { padding: 3rem 0; background: var(--bg-secondary); } .keyboard-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2rem; flex-wrap: wrap; gap: 1rem; } .keyboard-tabs { display: flex; gap: 0.5rem; } .tab-btn { padding: 0.75rem 1.5rem; border: 1px solid var(--border-color); background: var(--bg-primary); color: var(--text-primary); border-radius: 8px; cursor: pointer; font-weight: 500; transition: all 0.3s ease; } .tab-btn.active { background: var(--text-accent); color: white; border-color: var(--text-accent); } .tab-btn:hover:not(.active) { background: var(--bg-tertiary); } .sound-control { display: flex; align-items: center; gap: 10px; } .reset-btn { background: var(--gradient-primary); color: white; border: none; padding: 8px 16px; border-radius: 6px; font-size: 14px; font-weight: 500; cursor: pointer; transition: all 0.3s ease; box-shadow: var(--shadow-light); } .reset-btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-medium); } .reset-btn:active { transform: translateY(0); } .sound-label { font-weight: 500; color: var(--text-primary); } .sound-select { padding: 0.5rem; border: 1px solid var(--border-color); border-radius: 6px; background: var(--bg-primary); color: var(--text-primary); font-size: 0.9rem; } /* 键盘容器布局修改 */ .keyboard-container { display: flex; gap: 2rem; align-items: flex-start; justify-content: center; } /* 统计面板样式调整 */ .stats-panel { width: 350px; background: var(--bg-primary); border: 1px solid var(--border-color); border-radius: 12px; padding: 1.5rem; box-shadow: var(--shadow-medium); order: 1; /* 确保在左边 */ } .stats-panel.show { display: block; } .keyboard-wrapper { flex: 1; order: 2; /* 确保在右边 */ max-width: 1200px; } .keyboard-content { display: none; } .keyboard-content.active { display: block; } /* 统计面板内容样式 */ .stats-header h3 { color: var(--text-primary); margin-bottom: 1rem; text-align: center; font-size: 1.2rem; } .stats-content { display: flex; flex-direction: column; gap: 1rem; } .stat-item { display: flex; justify-content: space-between; align-items: center; padding: 0.75rem; background: var(--bg-secondary); border-radius: 8px; border: 1px solid var(--border-color); } .stat-label { font-weight: 600; color: var(--text-secondary); font-size: 0.9rem; } .stat-value { font-size: 1.5rem; font-weight: bold; color: var(--text-accent); } .chart-container { margin-top: 1rem; padding: 1rem; background: var(--bg-secondary); border-radius: 8px; text-align: center; border: 1px solid var(--border-color); } #statsChart { max-width: 100%; height: auto; border-radius: 4px; } /* 响应式调整 */ @media (max-width: 1024px) { .keyboard-container { flex-direction: column; align-items: center; } .stats-panel { order: 2; width: 100%; max-width: 600px; margin-top: 1rem; } .keyboard-wrapper { order: 1; width: 100%; } } @media (max-width: 768px) { .keyboard-container { gap: 1rem; } .stats-panel { padding: 1rem; } .stat-item { padding: 0.5rem; } .stat-value { font-size: 1.2rem; } } @media (max-width: 480px) { .stats-panel { width: 100%; margin: 0; } .chart-container { padding: 0.5rem; } } /* 工具说明区域 */ .tools-section { padding: 4rem 0; background: var(--bg-primary); } .section-title { text-align: center; font-size: 2.5rem; font-weight: bold; color: var(--text-primary); margin-bottom: 3rem; } .tools-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 2rem; } .tool-card { background: var(--bg-secondary); border: 1px solid var(--border-color); border-radius: 12px; padding: 2rem; text-align: center; transition: all 0.3s ease; cursor: pointer; } .tool-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-heavy); border-color: var(--text-accent); } .tool-icon { font-size: 3rem; margin-bottom: 1rem; background: var(--gradient-primary); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; } .tool-title { font-size: 1.5rem; font-weight: bold; color: var(--text-primary); margin-bottom: 1rem; } .tool-description { color: var(--text-secondary); line-height: 1.6; } /* 页脚 */ .footer { background: var(--bg-secondary); border-top: 1px solid var(--border-color); padding: 3rem 0 1rem; } .footer-content { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 2rem; margin-bottom: 2rem; } .footer-section h4 { color: var(--text-primary); font-size: 1.2rem; margin-bottom: 1rem; } .footer-links { list-style: none; } .footer-links li { margin-bottom: 0.5rem; } .footer-links a { color: var(--text-secondary); text-decoration: none; transition: color 0.3s ease; } .footer-links a:hover { color: var(--text-accent); } .footer-bottom { text-align: center; padding-top: 2rem; border-top: 1px solid var(--border-color); color: var(--text-secondary); } /* 鼠标和按键信息显示面板 */ .input-info-panel { background: var(--card-bg); border-top: 2px solid var(--primary-color); padding: 20px 0; margin-top: 20px; box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1); } .info-display { display: flex; justify-content: space-between; align-items: center; background: var(--bg-color); border: 2px solid var(--border-color); border-radius: 12px; padding: 20px; box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.1); } .mouse-info, .keyboard-info { flex: 1; padding: 0 20px; } .mouse-info h4, .keyboard-info h4 { color: var(--primary-color); margin: 0 0 15px 0; font-size: 16px; font-weight: 600; text-align: center; } .mouse-position, .mouse-buttons, .current-keys, .last-key { display: flex; justify-content: space-between; align-items: center; margin: 10px 0; padding: 8px 12px; background: var(--card-bg); border: 1px solid var(--border-color); border-radius: 6px; font-family: 'Courier New', monospace; } .mouse-position span:first-child, .mouse-buttons span:first-child, .current-keys span:first-child, .last-key span:first-child { color: var(--text-secondary); font-weight: 500; } .mouse-position span:last-child, .mouse-buttons span:last-child, .current-keys span:last-child, .last-key span:last-child { color: var(--primary-color); font-weight: 600; background: var(--primary-color-light); padding: 4px 8px; border-radius: 4px; min-width: 120px; text-align: center; } /* 鼠标按键统计区域样式 */ .mouse-stats-area { display: flex; justify-content: center; margin-bottom: 1.5rem; } .mouse-button-stats { display: flex; gap: 1rem; background: var(--bg-secondary); padding: 0.5rem; border-radius: 8px; border: 1px solid var(--border-color); box-shadow: var(--shadow-light); } .mouse-btn-stat { position: relative; display: flex; align-items: center; justify-content: center; min-width: 80px; height: 42px; /* 与tab按钮高度一致 */ background: var(--key-bg); border: 1px solid var(--key-border); border-radius: 6px; cursor: pointer; transition: all 0.3s ease; font-weight: 500; color: var(--text-primary); } .mouse-btn-stat:hover { background: var(--bg-tertiary); transform: translateY(-1px); box-shadow: var(--shadow-medium); } .mouse-btn-stat.active { background: var(--key-active) !important; color: white !important; border-color: var(--key-active) !important; transform: translateY(-2px); box-shadow: var(--shadow-medium); } .mouse-btn-label { font-size: 14px; user-select: none; } .mouse-btn-count { position: absolute; top: 2px; right: 4px; background: #ff4444; color: white; font-size: 10px; font-weight: bold; min-width: 16px; height: 16px; border-radius: 8px; display: flex; align-items: center; justify-content: center; line-height: 1; box-shadow: 0 1px 3px rgba(0,0,0,0.3); z-index: 10; pointer-events: none; /* 防止计数数字阻挡点击事件 */ } .mouse-btn-count:empty, .mouse-btn-count[data-count="0"] { display: none; } /* 暗色主题下的鼠标按键统计样式 */ [data-theme="dark"] .mouse-btn-count { background: #ff6666; box-shadow: 0 1px 3px rgba(0,0,0,0.5); } /* 导航菜单图标样式 */ .nav-icon { display: inline-block; margin-right: 6px; font-size: 16px; vertical-align: middle; } .menu-icon { display: inline-block; margin-right: 8px; font-size: 14px; vertical-align: middle; } /* 按键变色样式 - 根据按压次数 */ .key { transition: all 0.3s ease; } /* 按压次数颜色变化 */ .key.press-count-1 { background: #22c55e !important; /* 绿色 - 1次 */ color: white; border-color: #16a34a; } .key.press-count-2, .key.press-count-3, .key.press-count-4 { background: #16a34a !important; /* 深绿色 - 2-4次 */ color: white; border-color: #15803d; } .key.press-count-5, .key.press-count-6, .key.press-count-7, .key.press-count-8 { background: #a16207 !important; /* 褐色 - 5-8次 */ color: white; border-color: #92400e; } .key.press-count-9-plus { background: #7c3aed !important; /* 紫色 - 9次以上 */ color: white; border-color: #6d28d9; } /* 暗色主题下的按键变色 */ [data-theme="dark"] .key.press-count-1 { background: #16a34a !important; border-color: #15803d; } [data-theme="dark"] .key.press-count-2, [data-theme="dark"] .key.press-count-3, [data-theme="dark"] .key.press-count-4 { background: #15803d !important; border-color: #166534; } [data-theme="dark"] .key.press-count-5, [data-theme="dark"] .key.press-count-6, [data-theme="dark"] .key.press-count-7, [data-theme="dark"] .key.press-count-8 { background: #92400e !important; border-color: #78350f; } [data-theme="dark"] .key.press-count-9-plus { background: #6d28d9 !important; border-color: #5b21b6; } /* 确保鼠标点击时不会触发变色 */ .key.mouse-clicked { /* 鼠标点击时保持原色,不应用按压变色 */ } /* 响应式设计 */ @media (max-width: 768px) { .nav-icon { margin-right: 4px; font-size: 14px; } .menu-icon { margin-right: 6px; font-size: 12px; } .nav-menu { display: none; } .hamburger { display: flex; } .nav-actions { gap: 0.5rem; } .action-btn .btn-text { display: none; } .hero-title { font-size: 2rem; } .hero-subtitle { font-size: 1rem; } .keyboard-header { flex-direction: column; align-items: stretch; } .keyboard-container { flex-direction: column; } .stats-panel { width: 100%; } .key { min-width: 30px; height: 35px; font-size: 0.7rem; } .key-wide { min-width: 60px; } .key-extra-wide { min-width: 80px; } .key-shift { min-width: 90px; } .key-space { min-width: 200px; } .tools-grid { grid-template-columns: 1fr; } .scroll-buttons { right: 10px; bottom: 10px; } .theme-toggle { top: 10px; right: 10px; width: 40px; height: 40px; } .theme-icon { font-size: 20px; } .scroll-btn { width: 40px; height: 40px; font-size: 16px; } .info-display { flex-direction: column; gap: 20px; } .mouse-info, .keyboard-info { padding: 0; width: 100%; } .mouse-button-stats { gap: 0.5rem; padding: 0.3rem; } .mouse-btn-stat { min-width: 60px; height: 36px; } .mouse-btn-label { font-size: 12px; } .mouse-btn-count { font-size: 9px; min-width: 14px; height: 14px; } } @media (max-width: 480px) { .container { padding: 0 10px; } .keyboard { padding: 1rem; } .key { min-width: 25px; height: 30px; font-size: 0.6rem; } .key-wide { min-width: 50px; } .key-extra-wide { min-width: 65px; } .key-shift { min-width: 75px; } .key-space { min-width: 150px; } } /* 动画效果 */ @keyframes fadeIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } } @keyframes slideIn { from { transform: translateX(-100%); } to { transform: translateX(0); } } @keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05); } } .tool-card:hover .tool-icon { animation: pulse 1s infinite; } .keyboard-content { animation: fadeIn 0.5s ease; } .notification.show { animation: fadeIn 0.3s ease; } /* 全尺寸键盘布局样式 */ .keyboard.full-size { max-width: 1200px; width: 100%; } .keyboard-main { display: flex; gap: 1rem; justify-content: center; align-items: flex-start; } .main-keyboard { display: flex; flex-direction: column; gap: 0.25rem; } .edit-section { display: flex; flex-direction: column; gap: 0.5rem; margin-left: 0.5rem; } .edit-keys-group { display: flex; gap: 0.25rem; } .arrow-keys { display: flex; flex-direction: column; align-items: center; gap: 0.25rem; margin-top: 0.5rem; } .arrow-row { display: flex; gap: 0.25rem; } .numpad { display: flex; flex-direction: column; gap: 0.25rem; margin-left: 0.5rem; } .numpad-row { display: flex; gap: 0.25rem; position: relative; } .numpad-tall { height: 85px; position: absolute; right: 0; } .numpad-row:nth-child(2) .numpad-tall { top: 0; } .numpad-row:nth-child(4) .numpad-tall { top: 0; height: 85px; } .numpad-wide { min-width: 85px; } /* 响应式调整 */ @media (max-width: 1024px) { .keyboard-main { flex-direction: column; align-items: center; } .edit-section, .numpad { margin-left: 0; margin-top: 1rem; } } @media (max-width: 768px) { .keyboard.full-size { transform: scale(0.8); transform-origin: center; } .numpad, .edit-section { display: none; } } @media (max-width: 480px) { .keyboard.full-size { transform: scale(0.6); } } /* fn键特殊样式 */ .key-fn { min-width: 50px; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; font-weight: bold; border: 1px solid #5a67d8; font-size: 0.75rem; } .key-fn:hover { background: linear-gradient(135deg, #5a67d8 0%, #667eea 100%); transform: translateY(-1px); box-shadow: 0 4px 8px rgba(90, 103, 216, 0.3); } .key-fn.active, .key-fn.pressed { background: linear-gradient(135deg, #4c51bf 0%, #553c9a 100%); transform: translateY(1px); box-shadow: inset 0 2px 4px rgba(0,0,0,0.3); } /* 夜间模式下的fn键样式 */ [data-theme="dark"] .key-fn { background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%); border-color: #4a5568; } [data-theme="dark"] .key-fn:hover { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3); } /* 在第715行的 .keyboard 样式之前添加以下样式 */ /* 键盘基础布局样式 */ .keyboard { background: linear-gradient(145deg, #f8f9fa, #e9ecef); border-radius: 16px; padding: 20px; box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1), 0 10px 20px rgba(0, 0, 0, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.1), inset 0 -1px 0 rgba(0, 0, 0, 0.1); border: 2px solid; border-image: linear-gradient(145deg, rgba(255, 255, 255, 0.8), var(--border-color), rgba(0, 0, 0, 0.1)) 1; max-width: 100%; overflow-x: auto; } /* 键盘行布局 */ .function-row, .number-row, .letter-row, .control-row { display: flex; gap: 0.25rem; margin-bottom: 0.25rem; justify-content: center; } .key-group { display: flex; gap: 0.25rem; margin-right: 0.5rem; } /* 按键基础样式 */ .key { min-width: 40px; height: 40px; position: relative; display: flex; align-items: center; justify-content: center; background: linear-gradient(145deg, var(--key-bg), #f0f0f0); border: 1px solid var(--key-border); border-radius: 8px; cursor: pointer; font-weight: 500; font-size: 14px; color: var(--text-primary); user-select: none; transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1); /* 3D立体效果 */ box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.1), inset 0 -1px 0 rgba(0, 0, 0, 0.1); /* 渐变背景增强立体感 */ background: linear-gradient(145deg, rgba(255, 255, 255, 0.9) 0%, var(--key-bg) 50%, rgba(0, 0, 0, 0.05) 100%); /* 边框渐变 */ border: 2px solid; border-image: linear-gradient(145deg, rgba(255, 255, 255, 0.8), var(--key-border), rgba(0, 0, 0, 0.2)) 1; /* 文字阴影增强立体感 */ text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1); /* 变换原点设置为中心 */ transform-origin: center center; transform-style: preserve-3d; } .key-count { position: absolute; top: 2px; right: 2px; background: transparent; color: #ff4444; font-size: 10px; font-weight: bold; padding: 0; border-radius: 0; min-width: auto; height: auto; display: flex; align-items: center; justify-content: center; box-shadow: none; z-index: 10; line-height: 1; } /* 暗色主题下的计数样式 */ [data-theme="dark"] .key-count { background: transparent; color: #ff6666; box-shadow: none; } /* 小按键的计数样式调整 */ .key.small .key-count { font-size: 8px; padding: 0; min-width: auto; height: auto; } /* 悬停效果 */ .key:hover { transform: translateY(-2px) scale(1.02); box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15), 0 4px 8px rgba(0, 0, 0, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.2), inset 0 -1px 0 rgba(0, 0, 0, 0.1); background: linear-gradient(145deg, rgba(255, 255, 255, 0.95) 0%, var(--key-bg) 50%, rgba(0, 0, 0, 0.03) 100%); } /* 按键激活状态 - 音乐跳动美感 */ .key.active, .key.pressed { animation: keyPressJump 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55); transform: translateY(4px) scale(0.95); /* 按下时的阴影效果 */ box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2), 0 1px 2px rgba(0, 0, 0, 0.15), inset 0 2px 4px rgba(0, 0, 0, 0.1), inset 0 -1px 0 rgba(255, 255, 255, 0.1); /* 按下时的背景变化 */ background: linear-gradient(145deg, rgba(0, 0, 0, 0.05) 0%, var(--key-pressed) 50%, rgba(0, 0, 0, 0.1) 100%); /* 发光效果 */ box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2), 0 0 20px rgba(59, 130, 246, 0.3), 0 0 40px rgba(59, 130, 246, 0.1), inset 0 2px 4px rgba(0, 0, 0, 0.1); } /* 特殊按键宽度 */ .key-wide { min-width: 60px; } .key-extra-wide { min-width: 80px; } .key-shift { min-width: 100px; } .key-space { min-width: 200px; } /* 按键计数颜色系统 */ .key[data-count="1"] { background-color: #e3f2fd; } .key[data-count="2"] { background-color: #bbdefb; } .key[data-count="3"] { background-color: #90caf9; } .key[data-count="4"] { background-color: #64b5f6; } .key[data-count="5"] { background-color: #42a5f5; } .key[data-count="6"] { background-color: #2196f3; } .key[data-count="7"] { background-color: #1e88e5; } .key[data-count="8"] { background-color: #1976d2; } .key[data-count="9"] { background-color: #1565c0; } .key[data-count="10"] { background-color: #0d47a1; color: white; } /* 音乐跳动动画 */ @keyframes keyPressJump { 0% { transform: translateY(0) scale(1) rotateX(0deg); box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1), 0 0 0 rgba(59, 130, 246, 0); } 25% { transform: translateY(-8px) scale(1.05) rotateX(-5deg); box-shadow: 0 12px 24px rgba(0, 0, 0, 0.2), 0 0 30px rgba(59, 130, 246, 0.4); } 50% { transform: translateY(-12px) scale(1.08) rotateX(-8deg); box-shadow: 0 16px 32px rgba(0, 0, 0, 0.25), 0 0 40px rgba(59, 130, 246, 0.6); } 75% { transform: translateY(-6px) scale(1.03) rotateX(-3deg); box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15), 0 0 25px rgba(59, 130, 246, 0.3); } 100% { transform: translateY(4px) scale(0.95) rotateX(2deg); box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2), 0 0 20px rgba(59, 130, 246, 0.2); } } /* 连续按键时的波纹效果 */ .key.active::before { content: ''; position: absolute; top: 50%; left: 50%; width: 0; height: 0; background: radial-gradient(circle, rgba(59, 130, 246, 0.3) 0%, transparent 70%); border-radius: 50%; transform: translate(-50%, -50%); animation: rippleEffect 0.6s ease-out; pointer-events: none; z-index: 1; } @keyframes rippleEffect { 0% { width: 0; height: 0; opacity: 1; } 100% { width: 200%; height: 200%; opacity: 0; } } /* 按键弹跳动画 */ @keyframes keyBounce { 0% { transform: scale(1) translateY(0); } 50% { transform: scale(1.1) translateY(-3px); } 100% { transform: scale(1) translateY(0); } } .key.bounce { animation: keyBounce 0.3s ease; } /* 暗色主题下的立体效果 */ [data-theme="dark"] .key { background: linear-gradient(145deg, rgba(255, 255, 255, 0.1) 0%, var(--key-bg) 50%, rgba(0, 0, 0, 0.3) 100%); box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3), 0 2px 4px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.05), inset 0 -1px 0 rgba(0, 0, 0, 0.3); text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5); } [data-theme="dark"] .key:hover { background: linear-gradient(145deg, rgba(255, 255, 255, 0.15) 0%, var(--key-bg) 50%, rgba(0, 0, 0, 0.2) 100%); box-shadow: 0 8px 16px rgba(0, 0, 0, 0.4), 0 4px 8px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.1), inset 0 -1px 0 rgba(0, 0, 0, 0.3); } [data-theme="dark"] .key.active, [data-theme="dark"] .key.pressed { background: linear-gradient(145deg, rgba(0, 0, 0, 0.2) 0%, var(--key-pressed) 50%, rgba(0, 0, 0, 0.4) 100%); box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4), 0 0 20px rgba(77, 166, 255, 0.4), 0 0 40px rgba(77, 166, 255, 0.2), inset 0 2px 4px rgba(0, 0, 0, 0.3); } [data-theme="dark"] .keyboard { background: linear-gradient(145deg, #2d2d2d, #1a1a1a); box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3), 0 10px 20px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.05), inset 0 -1px 0 rgba(0, 0, 0, 0.3); } /* 特殊按键的增强效果 */ .key[data-key="Space"] { background: linear-gradient(145deg, rgba(255, 255, 255, 0.95) 0%, #f8f9fa 30%, var(--key-bg) 70%, rgba(0, 0, 0, 0.05) 100%); } .key[data-key="Enter"] { background: linear-gradient(145deg, rgba(34, 197, 94, 0.1) 0%, var(--key-bg) 50%, rgba(34, 197, 94, 0.05) 100%); } .key[data-key="Backspace"] { background: linear-gradient(145deg, rgba(239, 68, 68, 0.1) 0%, var(--key-bg) 50%, rgba(239, 68, 68, 0.05) 100%); } /* 功能键的特殊效果 */ .function-row .key { background: linear-gradient(145deg, rgba(99, 102, 241, 0.1) 0%, var(--key-bg) 50%, rgba(99, 102, 241, 0.05) 100%); } /* 数字键的特殊效果 */ .number-row .key { background: linear-gradient(145deg, rgba(168, 85, 247, 0.1) 0%, var(--key-bg) 50%, rgba(168, 85, 247, 0.05) 100%); } /* 响应式调整 */ @media (max-width: 768px) { .keyboard { padding: 1rem; } .key { min-width: 30px; height: 35px; font-size: 0.7rem; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.1); } .key.active, .key.pressed { animation: keyPressJumpMobile 0.25s cubic-bezier(0.68, -0.55, 0.265, 1.55); } .key-wide { min-width: 45px; } .key-extra-wide { min-width: 60px; } .key-shift { min-width: 75px; } .key-space { min-width: 150px; } .function-row, .number-row, .letter-row, .control-row { gap: 0.15rem; } .key-group { gap: 0.15rem; margin-right: 0.3rem; } } @keyframes keyPressJumpMobile { 0% { transform: translateY(0) scale(1); } 50% { transform: translateY(-6px) scale(1.05); } 100% { transform: translateY(2px) scale(0.98); } } @media (max-width: 480px) { .key { min-width: 25px; height: 30px; font-size: 0.6rem; } .key-wide { min-width: 35px; } .key-extra-wide { min-width: 45px; } .key-shift { min-width: 55px; } .key-space { min-width: 100px; } }