.game-controls { position: fixed; bottom: 0; left: 0; right: 0; height: 100vh; width: 100vw; z-index: 1000; touch-action: none; -webkit-touch-action: none; user-select: none; -webkit-user-select: none; background: none; pointer-events: auto; display: block !important; visibility: visible !important; } /* 顶部按钮组 */ .top-buttons { position: fixed; top: 15px; right: 15px; display: flex; gap: 8px; z-index: 1001; } .hide-button { position: fixed; top: 15px; left: 15px; width: 36px; height: 36px; background: rgba(45, 45, 50, 0.85); border-radius: 8px; box-shadow: none; display: flex; align-items: center; justify-content: center; z-index: 1001; -webkit-tap-highlight-color: transparent; } .hide-button .icon { width: 24px; height: 24px; } .hide-button:active { background: rgba(65, 65, 70, 0.95); } .hide-button.active { background: rgba(75, 75, 80, 0.95); } .keyboard-toggle, .pgdn-button, .menu-button { width: 44px; height: 44px; background: rgba(45, 45, 50, 0.85); border-radius: 8px; display: flex; align-items: center; justify-content: center; -webkit-tap-highlight-color: transparent; position: relative; } .menu-button { background: rgba(55, 55, 60, 0.9); } .pgdn-button { background: rgba(55, 55, 60, 0.9); } .menu-button .icon, .pgdn-button .icon { width: 28px; height: 28px; color: rgba(255, 255, 255, 0.95); } .keyboard-toggle:active, .pgdn-button:active, .menu-button:active, .keyboard-toggle.pressed, .pgdn-button.pressed, .menu-button.pressed { background: rgba(65, 65, 70, 0.95); transform: scale(0.95); } /* 添加按钮激活效果 */ .menu-button.active, .pgdn-button.active { background: rgba(75, 75, 80, 0.95); } /* 方向键 */ .d-pad { position: fixed; bottom: 25px; left: 25px; width: 160px; height: 160px; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); gap: 4px; padding: 8px; background: none; transform: translateZ(0); -webkit-transform: translateZ(0); backface-visibility: hidden; -webkit-backface-visibility: hidden; perspective: 1000; -webkit-perspective: 1000; } .d-pad-button, .action-button, .keyboard-toggle, .pgdn-button, .menu-button, .hide-button, .key { background: rgba(45, 45, 50, 0.85); border: none; border-radius: 8px; color: rgba(255, 255, 255, 0.9); transition: all 0.2s ease; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; visibility: visible !important; opacity: 1 !important; } .d-pad-button { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; -webkit-tap-highlight-color: transparent; } .action-button { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; -webkit-tap-highlight-color: transparent; } .key { background: rgba(50, 50, 55, 0.9); color: rgba(255, 255, 255, 0.95); min-width: 32px; height: 44px; display: flex; align-items: center; justify-content: center; font-size: 16px; font-weight: 400; flex: 1; -webkit-tap-highlight-color: transparent; user-select: none; font-family: system-ui, -apple-system, sans-serif; transition: all 0.15s ease-out; position: relative; overflow: hidden; will-change: background-color, transform; padding: 0 4px; box-sizing: border-box; transform: translateY(0); } /* 按键激活状态 */ .d-pad-button:active, .action-button:active, .keyboard-toggle:active, .pgdn-button:active, .menu-button:active, .hide-button:active, .key:active, .d-pad-button.pressed, .action-button.pressed, .keyboard-toggle.pressed, .pgdn-button.pressed, .menu-button.pressed, .hide-button.pressed { background: rgba(65, 65, 70, 0.95); transform: scale(0.95); } .key.active, .hide-button.active { background: rgba(75, 75, 80, 0.95); } .d-pad-up { grid-row: 1; grid-column: 2; } .d-pad-right { grid-row: 2; grid-column: 3; } .d-pad-down { grid-row: 3; grid-column: 2; } .d-pad-left { grid-row: 2; grid-column: 1; } /* 功能按钮 */ .action-buttons { position: fixed; bottom: 25px; right: 25px; width: 160px; height: 160px; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); gap: 4px; padding: 8px; background: none; transform: translateZ(0); -webkit-transform: translateZ(0); backface-visibility: hidden; -webkit-backface-visibility: hidden; perspective: 1000; -webkit-perspective: 1000; } .action-button[data-key="ok"] { grid-row: 2; grid-column: 3; } .action-button[data-key="cancel"] { grid-row: 2; grid-column: 1; } .action-button[data-key="shift"] { grid-row: 1; grid-column: 2; } .action-button[data-key="control"] { grid-row: 3; grid-column: 2; } /* 虚拟键盘 */ .virtual-keyboard { position: fixed; bottom: 0; left: 0; right: 0; background: rgba(35, 35, 40, 0.95); padding: 6px 8px 8px; z-index: 1000; border-top: none; visibility: visible; opacity: 1; transform: translateZ(0); -webkit-transform: translateZ(0); display: none; max-height: 45vh; overflow-y: auto; box-sizing: border-box; } .virtual-keyboard.show { display: block; } /* 修复键盘网格布局 */ .keyboard-grid { display: block; width: 100%; max-width: 480px; margin: 0 auto; padding: 0; box-sizing: border-box; } .keyboard-row { display: flex; gap: 2px; justify-content: center; margin-bottom: 2px; min-height: 38px; padding: 0; box-sizing: border-box; width: 100%; } /* 字母键样式 */ .key { min-width: 28px; height: 38px; padding: 0 2px; font-size: 15px; margin: 0; border-radius: 6px; background: rgba(50, 50, 55, 0.9); flex: 1; box-sizing: border-box; } /* 特殊按键样式 */ .key-backspace, .key-enter { min-width: 42px; flex: 1.2; } .key-space { min-width: 120px; flex: 2; } .key-shift, .key-symbols { min-width: 38px; flex: 1.1; } /* 关闭按钮行特殊处理 */ .keyboard-row:last-child { display: flex; justify-content: center; margin-bottom: 2px; min-height: 38px; padding: 0; box-sizing: border-box; width: 100%; } /* 关闭按钮样式重写 */ .key-hide { min-width: 80px; flex: 1; background: rgba(60, 60, 65, 0.9); font-weight: 500; } #normalKeyboard, #numericKeyboard { width: 100%; height: auto; transition: all 0.3s ease; } .show { display: block !important; } /* 图标样式 */ .icon { width: 24px; height: 24px; display: flex !important; align-items: center; justify-content: center; color: rgba(255, 255, 255, 0.95); margin: 0 auto; visibility: visible !important; opacity: 0.95 !important; } .icon svg { width: 100%; height: 100%; fill: currentColor; display: block !important; } .d-pad-button .icon { width: 32px; height: 32px; } .action-button .icon { width: 28px; height: 28px; } .key .icon { width: 20px; height: 20px; } .key-symbols:active, .key-symbols.active { background: rgba(70, 70, 75, 0.95); } .key-hide:active, .key-hide.active { background: rgba(70, 70, 75, 0.95); } #normalKeyboard .keyboard-row:first-child { padding-left: 0; } #normalKeyboard .keyboard-row:nth-child(2) { padding-left: 0; } #normalKeyboard .keyboard-row:nth-child(3) { padding-left: 0; } /* 防止触摸时的选择和高亮 */ .game-controls * { -webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; } /* 确保所有按钮都有相同的过渡效果 */ .d-pad-button, .action-button, .keyboard-toggle, .pgdn-button, .menu-button, .hide-button { transition: all 0.15s ease-out; transform: translateY(0); box-shadow: none; border: none; } .d-pad-button:active, .action-button:active, .keyboard-toggle:active, .pgdn-button:active, .menu-button:active, .hide-button:active, .d-pad-button.pressed, .action-button.pressed, .keyboard-toggle.pressed, .pgdn-button.pressed, .menu-button.pressed, .hide-button.pressed { transform: translateY(0); } /* 响应式布局适配 */ @media (max-width: 320px) { .keyboard-row { gap: 1px; margin-bottom: 1px; min-height: 34px; } .key { min-width: 24px; height: 34px; font-size: 14px; } .key-backspace, .key-enter { min-width: 36px; } .key-space { min-width: 100px; } .key-shift, .key-symbols { min-width: 32px; } .key-hide { min-width: 70px; } .virtual-keyboard { padding: 4px 6px 6px; } .keyboard-row:last-child { margin-top: 3px; height: 34px; } } @media (min-width: 321px) and (max-width: 375px) { .key { min-width: 26px; height: 36px; } .key-backspace, .key-enter { min-width: 40px; } .key-space { min-width: 110px; } .key-hide { min-width: 75px; } .virtual-keyboard { padding: 5px 7px 7px; } .keyboard-row:last-child { margin-top: 3px; height: 36px; } } @media (orientation: landscape) { .keyboard-grid { max-width: 600px; } .keyboard-row { gap: 3px; margin-bottom: 3px; min-height: 40px; } .key { min-width: 32px; height: 40px; font-size: 16px; } .key-space { min-width: 140px; } .key-hide { min-width: 90px; } .virtual-keyboard { padding: 5px 8px 8px; } .keyboard-row:last-child { margin-top: 5px; height: 40px; } } @media (orientation: landscape) and (max-height: 480px) { .keyboard-row { gap: 2px; margin-bottom: 2px; min-height: 32px; } .key { min-width: 28px; height: 32px; font-size: 14px; } .key-hide { width: 140px; height: 32px; line-height: 32px; } .virtual-keyboard { padding: 3px 2px 2px; } .keyboard-row:last-child { margin-top: 2px; height: 32px; } } /* 添加高对比度模式支持 */ @media (prefers-contrast: high) { .d-pad-button, .action-button, .keyboard-toggle, .pgdn-button, .menu-button, .hide-button, .key { background: rgba(30, 30, 35, 0.98); color: rgba(255, 255, 255, 1); } .d-pad-button:active, .action-button:active, .keyboard-toggle:active, .pgdn-button:active, .menu-button:active, .hide-button:active, .key:active, .d-pad-button.pressed, .action-button.pressed, .keyboard-toggle.pressed, .pgdn-button.pressed, .menu-button.pressed, .hide-button.pressed, .key.pressed { background: rgba(50, 50, 55, 0.98); } } /* 添加图标备用显示 */ .icon[data-fallback]::before { content: attr(data-fallback); display: none; } .icon svg:not(:root) + .icon[data-fallback]::before { display: block; } /* 移除所有backdrop-filter */ .d-pad-button, .action-button, .keyboard-toggle, .pgdn-button, .menu-button, .hide-button, .key, .virtual-keyboard { -webkit-backdrop-filter: none; backdrop-filter: none; }