/* 通用按键选择弹窗 */
.key-select-popup-overlay {
    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: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
}

.key-select-popup-overlay.active {
    opacity: 1;
    visibility: visible;
}

.key-select-popup-content {
    background: white;
    
    border-radius: 12px;
    width: 90%;
    max-width: 1050px;
    padding: 24px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: scale(0.95);
    transition: transform 0.2s ease;
}

.key-select-popup-overlay.active .key-select-popup-content {
    transform: scale(1);
}

/* 顶部标题栏 */
.popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.popup-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin: 0;
}

.popup-close-btn {
    width: 32px;
    height: 28px;
    border: none;
    background: #f5f5f5;
    border-radius: 50%;
    font-size: 12px;
    color: #999;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.popup-close-btn:hover {
    background: #e8e8e8;
    color: #666;
}

/* 标签页 */
.popup-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.tab-btn {
    padding: 10px 24px;
    border: none;
    border-radius: 8px;
    background: #f5f5f5;
    color: #666;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.2s;
}

.tab-btn.active {
    background: #1677ff;
    color: white;
}

/* 按键网格 */
.key-grid-container {
    border: 1px solid #e8e8e8;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
}

.key-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 12px;
}

.key-item {
    padding: 16px 8px;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    text-align: center;
    font-size: 14px;
    color: #333;
    cursor: pointer;
    transition: all 0.2s;
    background: #fafafa;
}

.key-item:hover {
    border-color: #1677ff;
    background: #f0f7ff;
    color: #1677ff;
}

.key-item.active {
    background: #1677ff;
    color: white;
    border-color: #1677ff;
}

/* 连发设置 */
.turbo-settings {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 40px;
    padding: 20px;
    border: 1px solid #e8e8e8;
    border-radius: 12px;
    margin-bottom: 20px;
}

.turbo-group {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
}

.turbo-label {
    font-size: 15px;
    color: #333;
    font-weight: 500;
    white-space: nowrap;
}

.turbo-buttons {
    display: flex;
    gap: 0;
}

.turbo-btn {
    padding: 8px 20px;
    border: 1px solid #e8e8e8;
    background: white;
    color: #666;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.turbo-btn:first-child {
    border-radius: 8px 0 0 8px;
}

.turbo-btn:last-child {
    border-radius: 0 8px 8px 0;
}

.turbo-btn.active {
    background: #1677ff;
    color: white;
    border-color: #1677ff;
}
/* 连发禁用状态 */
.slider:disabled,
.slider-input input:disabled,
.slider-buttons button:disabled {
    opacity: 0.45;
    cursor: not-allowed !important;
    pointer-events: none;
}

/* 底部按钮 */
.popup-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.popup-btn {
    padding: 10px 32px;
    border-radius: 8px;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.popup-btn.primary {
    background: #1677ff;
    color: white;
}

.popup-btn.primary:hover {
    background: #4096ff;
}

.popup-btn.secondary {
    background: #f5f5f5;
    color: #666;
}

.popup-btn.secondary:hover {
    background: #e8e8e8;
}

/* 复用通用滑块样式 */
.slider-container {
    position: relative;
    flex: 1;
    padding-top: 24px;
}

.slider {
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    background: #e8e8e8;
    border-radius: 3px;
    outline: none;
    margin: 0;
}

.slider::-webkit-slider-runnable-track {
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(to right, #1677ff 0%, #1677ff var(--progress, 0%), #e8e8e8 var(--progress, 0%), #e8e8e8 100%);
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #1677ff;
    cursor: pointer;
    margin-top: -6px;
}

.slider-value {
    position: absolute;
    top: 0;
    left: var(--progress, 0%);
    transform: translateX(-50%);
    background: #999999;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 13px;
    white-space: nowrap;
}

.slider-input {
    display: flex;
    align-items: center;
    gap: 4px;
}

.slider-input input {
    width: 50px;
    padding: 8px 6px;
    border: 1px solid #e8e8e8;
    border-radius: 6px;
    font-size: 15px;
    text-align: center;
    background: white;
}

.slider-buttons {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.slider-input button {
    width: 20px;
    height: 12px;
    border: none;
    background: transparent;
    color: #666;
    font-size: 10px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.slider-input button:hover {
    color: #1677ff;
}
/* 按键网格包装器（标签页切换用） */
.key-grid-wrapper {
    display: none;
}
.key-grid-wrapper.active {
    display: block;
}

/* 手柄按键网格 */
.gamepad-key-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 12px;
}

/* 键盘布局 */
.keyboard-layout {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.keyboard-row {
    display: flex;
    gap: 6px;
    justify-content: center;
}
.key-spacer {
    width: 24px;
    flex-shrink: 0;
}

/* 键盘按键尺寸 */
.key-item {
    padding: 8px 4px;
    min-width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e8e8e8;
    border-radius: 4px;
    text-align: center;
    font-size: 12px;
    color: #333;
    cursor: pointer;
    transition: all 0.2s;
    background: #fafafa;
    box-sizing: border-box;
}
.key-item.key-sm { min-width: 32px; }
.key-item.key-md { min-width: 56px; }
.key-item.key-lg { min-width: 76px; }
.key-item.key-xl { min-width: 96px; }
.key-item.key-xxl { min-width: 220px; }

.key-item:hover {
    border-color: #1677ff;
    background: #f0f7ff;
    color: #1677ff;
}
.key-item.active {
    background: #1677ff;
    color: white;
    border-color: #1677ff;
}
/* ========== 深色主题 - 按键选择弹窗 ========== */

/* 弹窗遮罩 */
body.dark-theme .key-select-popup-overlay {
    background: rgba(0, 0, 0, 0.7);
}

/* 弹窗主体 */
body.dark-theme .key-select-popup-content {
    background: #161b22;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
}

/* 标题栏 */
body.dark-theme .popup-title {
    color: #e6edf3;
}

body.dark-theme .popup-close-btn {
    background: #21262d;
    color: #8b949e;
}

body.dark-theme .popup-close-btn:hover {
    background: #30363d;
    color: #c9d1d9;
}

/* 标签页按钮 */
body.dark-theme .tab-btn {
    background: #21262d;
    color: #8b949e;
}

body.dark-theme .tab-btn.active {
    background: #1f6feb;
    color: white;
}

body.dark-theme .tab-btn:hover:not(.active) {
    background: #30363d;
    color: #c9d1d9;
}

/* 按键网格容器 */
body.dark-theme .key-grid-container,
body.dark-theme .turbo-settings {
    border-color: #30363d;
    background: #0d1117;
}

/* 单个按键 */
body.dark-theme .key-item {
    background: #161b22;
    border-color: #30363d;
    color: #c9d1d9;
}

body.dark-theme .key-item:hover {
    border-color: #1f6feb;
    background: #21262d;
    color: #58a6ff;
}

body.dark-theme .key-item.active {
    background: #1f6feb;
    color: white;
    border-color: #1f6feb;
}

/* 连发设置标签 */
body.dark-theme .turbo-label {
    color: #e6edf3;
}

/* 连发按钮组 */
body.dark-theme .turbo-btn {
    background: #0d1117;
    border-color: #30363d;
    color: #8b949e;
}

body.dark-theme .turbo-btn.active {
    background: #1f6feb;
    color: white;
    border-color: #1f6feb;
}

body.dark-theme .turbo-btn:hover:not(.active) {
    border-color: #484f58;
    color: #c9d1d9;
}

/* 底部按钮 */
body.dark-theme .popup-btn.primary {
    background: #1f6feb;
}

body.dark-theme .popup-btn.primary:hover {
    background: #388bfd;
}

body.dark-theme .popup-btn.secondary {
    background: #21262d;
    color: #c9d1d9;
    border: 1px solid #30363d;
}

body.dark-theme .popup-btn.secondary:hover {
    background: #30363d;
}

/* 滑块输入框 */
body.dark-theme .slider-input button:hover {
    color: #58a6ff;
}
