/* 全局样式 */ * { margin: 0; padding: 0; box-sizing: border-box; } body { font-family: 'Comic Neue', cursive; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); min-height: 100vh; overflow: hidden; } /* 游戏容器 */ .game-container { width: 100vw; height: 100vh; display: flex; flex-direction: column; position: relative; } /* 游戏标题区域 */ .game-header { background: rgba(255, 255, 255, 0.95); padding: 15px 20px; display: flex; justify-content: space-between; align-items: center; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); border-bottom: 3px solid #ff6b6b; } .header-controls { display: flex; align-items: center; gap: 15px; } .audio-button, .help-button { background: #ff6b6b; color: white; border: none; border-radius: 50%; width: 40px; height: 40px; font-size: 18px; cursor: pointer; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2); transition: all 0.3s ease; font-family: 'Comic Neue', cursive; font-weight: bold; } .audio-button:hover, .help-button:hover { background: #e55555; transform: scale(1.1); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3); } .audio-button:active, .help-button:active { transform: scale(0.95); } .audio-button.muted { background: #95a5a6; color: #bdc3c7; } .audio-button.muted:hover { background: #7f8c8d; } .game-title { font-family: 'Fredoka One', cursive; font-size: 2.2em; color: #ff6b6b; text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1); margin: 0; } .voice-status { display: flex; align-items: center; gap: 10px; background: #4ecdc4; padding: 8px 15px; border-radius: 25px; color: white; font-weight: bold; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2); } .mic-icon { font-size: 1.2em; animation: pulse 2s infinite; } @keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.1); } } /* 主游戏区域 */ .game-main { flex: 1; position: relative; display: flex; justify-content: center; align-items: center; } #gameCanvas { border: 4px solid #fff; border-radius: 20px; box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3); background: linear-gradient(45deg, #ffeaa7, #fab1a0); } /* 游戏UI覆盖层 */ .game-ui { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 10; } /* 键盘面板在game-ui内,需要特殊处理 */ .game-ui .keyboard-input-panel { pointer-events: auto; } .game-ui .keyboard-input-panel.inactive { pointer-events: none; } .game-ui .keyboard-input-panel.active { pointer-events: auto !important; } /* 确保激活状态下所有子元素都可以交互 */ .keyboard-input-panel.active, .keyboard-input-panel.active *, .keyboard-input-panel.active .input-content, .keyboard-input-panel.active .command-input, .keyboard-input-panel.active .send-btn, .keyboard-input-panel.active .quick-cmd, .keyboard-input-panel.active .toggle-panel-btn, .keyboard-input-panel.active .history-item { pointer-events: auto !important; } /* 魔法锅状态 */ .pot-status { position: absolute; top: 20px; left: 50%; transform: translateX(-50%); pointer-events: auto; } .status-indicator { padding: 10px 20px; border-radius: 25px; font-weight: bold; text-align: center; box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2); transition: all 0.3s ease; } .status-indicator.inactive { background: #95a5a6; color: white; } .status-indicator.active { background: #e74c3c; color: white; animation: glow 2s infinite alternate; } .status-indicator.cooking { background: #f39c12; color: white; animation: cooking-pulse 1s infinite; } .status-indicator.overflowing { background: #27ae60; color: white; animation: overflow-shake 0.5s infinite; } @keyframes glow { from { box-shadow: 0 4px 15px rgba(231, 76, 60, 0.3); } to { box-shadow: 0 4px 25px rgba(231, 76, 60, 0.8); } } @keyframes cooking-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05); } } @keyframes overflow-shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-2px); } 75% { transform: translateX(2px); } } /* 烹饪信息 */ .cooking-info { position: absolute; top: 80px; left: 50%; transform: translateX(-50%); background: rgba(255, 255, 255, 0.95); padding: 15px 25px; border-radius: 15px; box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2); text-align: center; min-width: 200px; } .cooking-food { font-size: 1.2em; font-weight: bold; color: #2c3e50; margin-bottom: 10px; } .progress-bar { width: 100%; height: 8px; background: #ecf0f1; border-radius: 4px; overflow: hidden; } .progress-fill { height: 100%; background: linear-gradient(90deg, #ff6b6b, #4ecdc4); border-radius: 4px; transition: width 0.3s ease; width: 0%; } /* 食物计数器 */ .food-counter { position: absolute; top: 20px; right: 20px; background: rgba(255, 255, 255, 0.95); padding: 15px 20px; border-radius: 15px; box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2); display: flex; align-items: center; gap: 10px; } /* 性能监控 */ .performance-monitor { position: absolute; top: 20px; left: 20px; background: rgba(0, 0, 0, 0.8); color: white; padding: 10px 15px; border-radius: 10px; font-family: 'Courier New', monospace; font-size: 0.9em; box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3); min-width: 120px; } .perf-item { display: flex; justify-content: space-between; margin-bottom: 5px; align-items: center; } .perf-item:last-child { margin-bottom: 0; } .perf-label { color: #4ecdc4; font-weight: bold; } .perf-value { color: #ffffff; font-weight: bold; text-align: right; min-width: 30px; } .food-emoji { font-size: 2em; } .count { font-size: 1.5em; font-weight: bold; color: #2c3e50; min-width: 30px; text-align: center; } /* 语音提示 */ .voice-hints { position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 10px; align-items: center; } .hint-item { background: rgba(0, 0, 0, 0.8); color: white; padding: 8px 15px; border-radius: 20px; display: flex; align-items: center; gap: 10px; font-size: 0.9em; animation: hint-fade-in 0.5s ease; } .hint-command { background: #ff6b6b; padding: 4px 8px; border-radius: 10px; font-weight: bold; font-size: 0.8em; } .hint-desc { opacity: 0.9; } @keyframes hint-fade-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } } /* 调试信息 */ .debug-info { position: absolute; top: 10px; left: 10px; background: rgba(0, 0, 0, 0.8); color: white; padding: 10px; border-radius: 5px; font-family: monospace; font-size: 0.8em; max-width: 300px; max-height: 200px; overflow-y: auto; z-index: 1000; } /* 响应式设计 */ @media (max-width: 768px) { .game-title { font-size: 1.5em; } #gameCanvas { width: 95vw; height: 70vh; } .voice-hints { bottom: 10px; } .hint-item { font-size: 0.8em; padding: 6px 12px; } } /* 动画效果 */ .bounce-in { animation: bounceIn 0.6s ease; } @keyframes bounceIn { 0% { transform: scale(0.3); opacity: 0; } 50% { transform: scale(1.05); } 70% { transform: scale(0.9); } 100% { transform: scale(1); opacity: 1; } } .fade-out { animation: fadeOut 0.5s ease forwards; } @keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } } /* 特殊效果 */ .sparkle { position: absolute; width: 4px; height: 4px; background: #ffd700; border-radius: 50%; animation: sparkle 1s ease-in-out infinite; } @keyframes sparkle { 0%, 100% { opacity: 0; transform: scale(0); } 50% { opacity: 1; transform: scale(1); } } /* 音频激活提示 */ .audio-activation-hint { position: absolute; top: 30%; left: 50%; transform: translate(-50%, -50%); z-index: 200; pointer-events: none; animation: audioHintPulse 2s infinite; } .hint-bubble { background: rgba(255, 107, 107, 0.95); border: 3px solid #e74c3c; border-radius: 20px; padding: 15px 25px; display: flex; align-items: center; gap: 10px; box-shadow: 0 8px 32px rgba(231, 76, 60, 0.3); color: white; font-family: 'Comic Neue', cursive; font-weight: bold; } .hint-icon { font-size: 1.5em; animation: audioIconBounce 1s infinite; } .hint-text { font-size: 1.1em; } @keyframes audioHintPulse { 0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.9; } 50% { transform: translate(-50%, -50%) scale(1.05); opacity: 1; } } @keyframes audioIconBounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } } /* 语音输入显示 */ .voice-input-display { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 100; pointer-events: none; } .speech-bubble { background: rgba(255, 255, 255, 0.95); border: 3px solid #ff6b6b; border-radius: 25px; padding: 20px 30px; position: relative; box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2); animation: speechBubble 0.3s ease-out; max-width: 400px; text-align: center; } .speech-bubble::before { content: ''; position: absolute; bottom: -15px; left: 50%; transform: translateX(-50%); width: 0; height: 0; border-left: 15px solid transparent; border-right: 15px solid transparent; border-top: 15px solid #ff6b6b; } .speech-bubble::after { content: ''; position: absolute; bottom: -12px; left: 50%; transform: translateX(-50%); width: 0; height: 0; border-left: 12px solid transparent; border-right: 12px solid transparent; border-top: 12px solid rgba(255, 255, 255, 0.95); } .speech-text { font-size: 1.4em; font-weight: bold; color: #2c3e50; margin-bottom: 8px; font-family: 'Comic Neue', cursive; line-height: 1.3; } .speech-confidence { font-size: 0.9em; color: #7f8c8d; font-style: italic; } @keyframes speechBubble { 0% { opacity: 0; transform: scale(0.3) translateY(20px); } 50% { transform: scale(1.1) translateY(-5px); } 100% { opacity: 1; transform: scale(1) translateY(0); } } /* 语音识别状态动画 */ .speech-bubble.listening { border-color: #e74c3c; animation: listening-pulse 1.5s infinite; } .speech-bubble.processing { border-color: #f39c12; animation: processing-spin 2s infinite linear; } .speech-bubble.recognized { border-color: #27ae60; animation: recognized-bounce 0.6s ease-out; } @keyframes listening-pulse { 0%, 100% { border-color: #e74c3c; box-shadow: 0 8px 32px rgba(231, 76, 60, 0.2); } 50% { border-color: #c0392b; box-shadow: 0 8px 32px rgba(231, 76, 60, 0.4); } } @keyframes processing-spin { 0% { border-color: #f39c12; transform: rotate(0deg); } 100% { border-color: #e67e22; transform: rotate(360deg); } } @keyframes recognized-bounce { 0% { transform: scale(1); } 30% { transform: scale(1.1); } 60% { transform: scale(0.95); } 100% { transform: scale(1); } } /* 帮助模态框 */ .help-modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 10000; animation: modalFadeIn 0.3s ease-out; } .modal-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.5); backdrop-filter: blur(5px); } .modal-content { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); background: white; border-radius: 20px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3); max-width: 600px; max-height: 80vh; overflow: hidden; font-family: 'Comic Neue', cursive; } .modal-header { background: linear-gradient(45deg, #ff6b6b, #4ecdc4); color: white; padding: 20px 30px; display: flex; justify-content: space-between; align-items: center; } .modal-header h2 { margin: 0; font-family: 'Fredoka One', cursive; font-size: 1.5em; } .modal-close { background: none; border: none; color: white; font-size: 24px; cursor: pointer; padding: 5px; border-radius: 50%; width: 35px; height: 35px; display: flex; align-items: center; justify-content: center; transition: background 0.3s ease; } .modal-close:hover { background: rgba(255, 255, 255, 0.2); } .modal-body { padding: 30px; overflow-y: auto; max-height: calc(80vh - 100px); } .help-section { margin-bottom: 25px; padding-bottom: 20px; border-bottom: 2px solid #f0f0f0; } .help-section:last-child { border-bottom: none; margin-bottom: 0; } .help-section h4 { color: #ff6b6b; margin-bottom: 10px; font-size: 1.2em; } .help-section p { margin-bottom: 10px; line-height: 1.5; color: #2c3e50; } .help-section ul { margin: 10px 0; padding-left: 20px; } .help-section li { margin-bottom: 5px; color: #34495e; line-height: 1.4; } .help-section strong { color: #e74c3c; } @keyframes modalFadeIn { 0% { opacity: 0; transform: scale(0.9); } 100% { opacity: 1; transform: scale(1); } } @keyframes modalFadeOut { 0% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: scale(0.9); } } /* 特殊消息动画 */ @keyframes specialMessage { 0% { opacity: 0; transform: translate(-50%, -50%) scale(0.3); } 20% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); } 30% { transform: translate(-50%, -50%) scale(1); } 70% { opacity: 1; transform: translate(-50%, -50%) scale(1); } 100% { opacity: 0; transform: translate(-50%, -50%) scale(0.8); } } /* 键盘输入调试面板 */ .keyboard-input-panel { position: fixed; bottom: 20px; right: 20px; background: rgba(44, 62, 80, 0.95); border: 2px solid #4ecdc4; border-radius: 15px; box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3); backdrop-filter: blur(10px); color: white; font-family: 'Comic Neue', cursive; min-width: 300px; max-width: 400px; transition: all 0.4s ease; z-index: 50; pointer-events: auto; cursor: move; user-select: none; } /* 面板激活状态 */ .keyboard-input-panel.active { z-index: 10000 !important; transform: scale(1.02); box-shadow: 0 12px 40px rgba(78, 205, 196, 0.4); border-color: #ff6b6b; background: rgba(44, 62, 80, 0.98); pointer-events: auto !important; } /* 拖拽状态 */ .keyboard-input-panel.dragging { transition: none !important; transform: scale(1.05) rotate(2deg); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5); z-index: 15000 !important; } .keyboard-input-panel.dragging .input-content { pointer-events: none; } .keyboard-input-panel.dragging .input-header { background: linear-gradient(45deg, #ff6b6b, #e74c3c); } /* 面板非激活状态(灰色透明) */ .keyboard-input-panel.inactive { opacity: 0.4; background: rgba(108, 117, 125, 0.7); border-color: #6c757d; transform: scale(0.95); pointer-events: none; } .keyboard-input-panel.inactive .input-header { background: linear-gradient(45deg, #6c757d, #495057); } .keyboard-input-panel.inactive .command-input { border-color: #6c757d; background: rgba(108, 117, 125, 0.3); color: rgba(255, 255, 255, 0.6); } .keyboard-input-panel.inactive .send-btn { background: linear-gradient(45deg, #6c757d, #495057); opacity: 0.6; } .keyboard-input-panel.inactive .quick-cmd { border-color: #6c757d; background: rgba(108, 117, 125, 0.2); color: rgba(255, 255, 255, 0.6); } .keyboard-input-panel:hover:not(.inactive) { transform: translateY(-5px); box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4); } .keyboard-input-panel.active:hover { transform: scale(1.02) translateY(-5px); box-shadow: 0 16px 50px rgba(78, 205, 196, 0.5); } .input-header { background: linear-gradient(45deg, #4ecdc4, #44a08d); padding: 15px 20px; border-radius: 13px 13px 0 0; display: flex; justify-content: space-between; align-items: center; border-bottom: 2px solid rgba(255, 255, 255, 0.1); cursor: move; user-select: none; } .input-header h4 { margin: 0; font-size: 1.1em; font-weight: bold; color: white; text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3); } .toggle-panel-btn { background: rgba(255, 255, 255, 0.2); border: none; border-radius: 50%; width: 35px; height: 35px; color: white; font-size: 16px; cursor: pointer; transition: all 0.3s ease; display: flex; align-items: center; justify-content: center; } .toggle-panel-btn:hover { background: rgba(255, 255, 255, 0.3); transform: scale(1.1); } .toggle-panel-btn:active { transform: scale(0.95); } .input-content { padding: 20px; transition: all 0.3s ease; } .input-content.collapsed { display: none; } .input-group { display: flex; gap: 10px; margin-bottom: 20px; } .command-input { flex: 1; padding: 12px 15px; border: 2px solid #4ecdc4; border-radius: 25px; background: rgba(255, 255, 255, 0.1); color: white; font-family: 'Comic Neue', cursive; font-size: 14px; outline: none; transition: all 0.3s ease; } .command-input::placeholder { color: rgba(255, 255, 255, 0.7); } .command-input:focus { border-color: #ff6b6b; background: rgba(255, 255, 255, 0.2); box-shadow: 0 0 15px rgba(255, 107, 107, 0.3); } .send-btn { background: linear-gradient(45deg, #ff6b6b, #e55555); border: none; border-radius: 25px; padding: 12px 20px; color: white; font-family: 'Comic Neue', cursive; font-weight: bold; font-size: 14px; cursor: pointer; transition: all 0.3s ease; box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3); } .send-btn:hover { background: linear-gradient(45deg, #e55555, #d63447); transform: translateY(-2px); box-shadow: 0 6px 20px rgba(255, 107, 107, 0.4); } .send-btn:active { transform: translateY(0); } .quick-commands { margin-bottom: 20px; } .quick-commands h5 { margin: 0 0 10px 0; color: #4ecdc4; font-size: 0.9em; font-weight: bold; text-transform: uppercase; letter-spacing: 1px; } .command-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; } .quick-cmd { background: rgba(78, 205, 196, 0.2); border: 1px solid #4ecdc4; border-radius: 20px; padding: 8px 12px; color: white; font-family: 'Comic Neue', cursive; font-size: 0.8em; cursor: pointer; transition: all 0.3s ease; text-align: center; } .quick-cmd:hover { background: rgba(78, 205, 196, 0.4); border-color: #44a08d; transform: scale(1.05); } .quick-cmd:active { transform: scale(0.95); } .command-history { border-top: 1px solid rgba(255, 255, 255, 0.1); padding-top: 15px; } .command-history h5 { margin: 0 0 10px 0; color: #4ecdc4; font-size: 0.9em; font-weight: bold; text-transform: uppercase; letter-spacing: 1px; } .history-list { max-height: 120px; overflow-y: auto; border-radius: 8px; background: rgba(0, 0, 0, 0.2); padding: 8px; } .history-item { background: rgba(255, 255, 255, 0.1); border-radius: 15px; padding: 6px 12px; margin-bottom: 5px; font-size: 0.8em; color: rgba(255, 255, 255, 0.9); display: flex; justify-content: space-between; align-items: center; cursor: pointer; transition: all 0.3s ease; } .history-item:hover { background: rgba(255, 255, 255, 0.2); transform: translateX(5px); } .history-item:last-child { margin-bottom: 0; } .history-command { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .history-time { color: rgba(255, 255, 255, 0.6); font-size: 0.7em; margin-left: 10px; } /* 滚动条样式 */ .history-list::-webkit-scrollbar { width: 4px; } .history-list::-webkit-scrollbar-track { background: rgba(255, 255, 255, 0.1); border-radius: 2px; } .history-list::-webkit-scrollbar-thumb { background: #4ecdc4; border-radius: 2px; } .history-list::-webkit-scrollbar-thumb:hover { background: #44a08d; } /* 面板折叠状态 */ .keyboard-input-panel.collapsed { min-width: auto; width: auto; } .keyboard-input-panel.collapsed .input-content { display: none; } /* 面板动画 */ @keyframes panelSlideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } } .keyboard-input-panel { animation: panelSlideIn 0.5s ease-out; } /* 响应式设计 */ @media (max-width: 768px) { .keyboard-input-panel { bottom: 10px; right: 10px; left: 10px; min-width: auto; max-width: none; } .command-buttons { grid-template-columns: 1fr; } .input-group { flex-direction: column; } .send-btn { align-self: flex-end; min-width: 100px; } }