       /* 基础样式 */
        html, body {
            margin: 0;
            padding: 0;
            height: 100%;
            font-family: 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
            background-color: #f0f2f5;
            color: #333;
            box-sizing: border-box;
        }
        *, *::before, *::after {
            box-sizing: inherit;
        }

        /* 输入框样式 */
        .input21 {
            border-radius: 10px;

            color: white;
            background-color: #333;
            box-shadow: 2px 2px 5px rgba(0,0,0,0.3);
        }
        .inputK16,.inputK18, .inputK24, .inputK32 {
        border: 3px solid #ff0000 !important; 
        color: #333; 
        background-color: #fff;
        box-shadow: 2px 2px 5px rgba(0,0,0,0.2);

        resize: none; 
        outline: none; 
        }
        .inputK16S,.inputK24S,.inputK32S {
        color: #fff; /* 白字 */
        background-color: #333; /* 黑底 */
        border-radius: 10px;

        box-shadow: 2px 2px 5px rgba(0,0,0,0.2);
    }

        /* 表格样式 */
        table {
            border-collapse: collapse;
            width: 100%;
            margin-top: 15px;
        }
        th, td {
            border: 1px solid #ddd;
            padding: 12px 15px;
            text-align: left;
            font-size: 23px;
        }
        th {
            background-color: #e9e9e9;
            font-weight: bold;
            color: #555;
        }
        tr:nth-child(even) {
            background-color: #f9f9f9;
        }

        /* 按钮样式 */
        .btnCom {
            background-color: #007bff;
            color: white;
            border: none;
            border-radius: 5px;
            padding: 10px 15px;
            cursor: pointer;
            transition: background-color 0.3s ease, transform 0.1s ease;
            font-weight: bold;
        }
        .btnCom:hover {
            background-color: #0056b3;
        }
        .btnCom:active {
            transform: translateY(1px);
        }
        input[type='button'] {
            background-color: #28a745;
            color: white;
            border: none;
            border-radius: 5px;
            padding: 10px 15px;
            cursor: pointer;
            transition: background-color 0.3s ease, transform 0.1s ease;
            font-weight: bold;
        }
        input[type='button']:hover {
            background-color: #218838;
        }
        input[type='button']:active {
            transform: translateY(1px);
        }
        input[value='查询'], input[value='删除'], input[value='清空'] {
            background-color: #ffc107;
            color: #333;
        }
        input[value='查询']:hover, input[value='删除']:hover, input[value='清空']:hover {
            background-color: #e0a800;
        }

        /* 顶部配置区 */
        .top-config-panel {
            background-color: #fff;
            border-radius: 10px;
            box-shadow: 0 2px 10px rgba(0,0,0,0.08);
            padding: 15px 20px;
            margin-top: 20px;
            display: block;
            width: 95%;
            max-width: 1400px;
            margin-left: auto;
            margin-right: auto;
        }
        .top-config-panel > div {
            display: flex;
            box-sizing: border-box;
            gap: 10px;
            margin-bottom: 10px;
        }
        .top-config-panel > div:last-child {
            margin-bottom: 0;
        }
        .top-config-panel .col {
            flex: 1;
            min-width: 180px;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 5px;
        }
        .top-config-panel .col span {
            font-size: 24px;
            font-weight: bold;
        }
        .top-config-panel .col select {
            width: 90%;
            border: 1px solid #ccc;
            border-radius: 5px;
            padding: 8px 10px;
            font-size: 20px;
            height: 45px;
            box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
        }
        .top-config-panel .col input {
            border: 1px solid #ccc;
            outline: none;
            font-size: 20px;
            border-radius: 5px;
            padding: 8px 10px;
            flex: 1;
            max-width: 78%;
        }
        .top-config-panel #img_Run {
            height: 64px;
            width: 64px;
            transition: transform 0.3s ease-in-out;
        }
        .top-config-panel #span_Lock {
            color: red;
            font-size: 24px;
            font-weight: bold;
        }

        /* 继电器状态区 */
        #div_RealyState {
            background-color: #fff;
            border-radius: 10px;
            box-shadow: 0 2px 10px rgba(0,0,0,0.08);
            padding: 15px;
            min-height: 80px;
            display: flex;
            flex-wrap: wrap;
            gap: 10px;
            align-items: center;
            justify-content: flex-start;
            width: 95%;
            margin: 10px auto 0;
        }
        .relay-status-item {
            padding: 5px 10px;
            border-radius: 4px;
            background-color: #e0e0e0;
            font-size: 16px;
            color: #555;
        }
        .relay-status-item.active {
            background-color: #28a745;
            color: white;
        }

        /* 模板管理区 */
        .template-section {
            background-color: #fff;
            border-radius: 10px;
            box-shadow: 0 2px 10px rgba(0,0,0,0.08);
            padding: 15px 20px;
            width: 95%;
            margin: 30px auto 0;
            display: flex;
            gap: 10px;
        }
        .template-section:last-of-type {
            width: 90%;
            margin-top: 10px;
            gap: 20px;
            padding: 10px;
        }
        .template-section .template-group {
            flex: 1;
            display: flex;
            align-items: center;
            flex-wrap: nowrap;
            gap: 6px;
        }
        .template-section .template-group span {
            font-size: 24px;
            font-weight: bold;
        }
        .template-section .template-group select {
            width: calc(60% - 10px);
            height: 45px;
            font-size: 20px;
            border-radius: 5px;
            border: 1px solid #ccc;
        }
        .template-section .template-group input[type="number"] {
            border: 1px solid #ccc;
            outline: none;
            font-size: 20px;
            border-radius: 5px;
            padding: 8px 10px;
        }
        .template-section .template-group input[type="button"] {
            padding: 8px 15px;
            font-size: 20px;
            height: 45px;
            white-space: nowrap;
        }

        /* 遥控器区域 */
        .remote-container {
            display: flex;
            width: 90%;
            margin: 30px auto 0;
            gap: 20px;
            flex-wrap: wrap;
        }

        .key-container {
            position: relative;
            width: 320px;          /* 或 100% */
            /*aspect-ratio: 1 / 3.2;*/ /* 按 24键图真实比例 */
        }
        /* 矮胖型 */
        .yk-short {
            aspect-ratio: 1 / 1.8;
        }

        /* 中等 */
        .yk-mid {
            aspect-ratio: 1 / 2.4;
        }

        /* 细长（三防 24 / 32） */
        .yk-long {
            aspect-ratio: 1 / 3.2;
        }
        .remote-background-image {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }

        /* 按键容器样式（确保与背景图尺寸绑定） */
        #div_Key, #div_Key_Click {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%; /* 与容器/背景图同宽 */
            height: 100%; /* 与容器/背景图同高 */
            z-index: 5;
        }

        /* 指示灯样式（可选，确保在容器内） */
        .indicator-led {
            position: absolute;
            z-index: 4;
            /* 保持原有宽度百分比，位置基于容器（与背景图同步） */
        }
       

        /* 功能配置表 */
        #div_KeyS {
            background-color: #fff;
            border-radius: 10px;
            box-shadow: 0 2px 10px rgba(0,0,0,0.08);
            padding: 20px;
            width:70%;
            overflow-x: auto;
            overflow-y: auto;
            max-height: 1000px;
            flex: 1;
        }
        #div_KeyS input, #div_KeyS select {
            width: 100%;
            padding: 8px;
            border: 1px solid #ccc;
            border-radius: 4px;
            font-size: 16px;
        }

        /* 操作按钮区 */
        .control-panel2 {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            /*grid-template-rows: repeat(3, 100px);*/
            grid-template-rows: repeat(0, 100px); 
            gap: 15px;
            padding: 20px;
            background-color: #fff;
            border-radius: 10px;
            box-shadow: 0 2px 10px rgba(0,0,0,0.08);
            max-width: 1200px;
            margin: 20px auto;
            width: 90%;
        }
        .control-panel2 input[type='button'],
        .control-panel2 .btnCom {
            padding: 10px 15px;
            font-size: 30px;
            border-radius: 20px;
            cursor: pointer;
            transition: all 0.3s ease;
            border: none;
        }
        .control-panel2 .checkbox-group {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 10px;
            padding: 5px;
        }
        .control-panel2 .checkbox-group span {
            font-size: 25px;
        }
        .control-panel2 input[type='checkbox'] {
            zoom: 150%;
        }

        /* 底部配置区 */
        #div_Name {
            background-color: #fff;
            border-radius: 10px;
            box-shadow: 0 2px 10px rgba(0,0,0,0.08);
            padding: 20px;
            margin: 30px auto 0;
            width: 90%;
            display: flex;
            flex-direction: column;
            gap: 20px;
        }
        #div_Name .save-id {
            width: 100%;
        }
        #span_SaveID {
            text-align: left;
            font-size: 20px;
        }
        #div_Name table {
            width: 100%;
        }
        #div_Name table td:first-child {
            width: 20%;
        }
        #div_Name table input, #div_Name table select {
            width: 100%;
            padding: 10px;
            border: 1px solid #ccc;
            border-radius: 5px;
            font-size: 18px;
            height: 45px;
            box-sizing: border-box;
        }
        #div_Name table td:last-child {
            display: flex;
            gap: 10px;
            justify-content: center;
            flex-wrap: wrap;
        }
        #div_Name table input[type='button'] {
            width: auto;
            flex-grow: 1;
            font-size: 20px;
            padding: 8px 15px;
        }
        #div_Lock {
            width: 100%;
            text-align: center;
        }
        #div_Name .config-row {
            display: flex;
            flex-wrap: wrap;
            gap: 20px;
            justify-content: center;
        }
        #div_Name .config-item {
            display: flex;
            align-items: center;
            gap: 10px;
        }
        #div_Name .auto-lock {
            display: flex;
            align-items: center;
            gap: 10px;
            justify-content: center;
        }
        #div_Name .auto-lock input {
            border: 1px solid #ccc;
            outline: none;
            font-size: 20px;
            border-radius: 5px;
            padding: 8px 10px;
        }
        #div_Name .memory-functions {
            display: flex;
            flex-wrap: wrap;
            gap: 30px;
            justify-content: center;
        }
        #div_Name .memory-functions .config-item input {
            margin-right: 10px;
            zoom: 150%;
        }
        #div_Name .order-list {
            text-align: center;
            margin-top: 10px;
        }
        #div_Name .order-list a {
            color: #007bff;
            text-decoration: none;
            font-weight: bold;
            font-size: 24px;
        }

        /* 互锁配置区样式 */
        .interlock-container {
            margin: 20px auto;
            padding: 15px;
            background-color: #fff;
            border-radius: 10px;
            box-shadow: 0 3px 10px rgba(0,0,0,0.08);
            overflow-x: auto;
        }
        .interlock-section-title {
            font-size: 20px;
            color: #2c3e50;
            margin-bottom: 12px;
            padding-left: 5px;
            border-left: 4px solid #007bff;
        }
        .interlock-table {
            width: 100%;
            border-collapse: collapse;
            min-width: 800px;
        }
        .interlock-table th {
            padding: 12px 15px;
            border: 1px solid #e0e6ed;
            font-weight: 600;
            color: #2c3e50;
            text-align: center;
            position: sticky;
            top: 0;
            z-index: 2;
            background-color: #f5f7fa;
        }
        .interlock-table td {
            padding: 10px 8px;
            border: 1px solid #e0e6ed;
            text-align: center;
        }
        .interlock-table tr:hover {
            background-color: #f9fafc;
        }
        .interlock-group-title {
            background-color: #f0f5ff;
            font-weight: 600;
            color: #1e50b3;
            position: sticky;
            left: 0;
            z-index: 1;
        }
        .interlock-group-merged {
            background-color: #ffe8cc;
            color: #e67e22;
            font-weight: bold;
        }
        .interlock-checkbox {
            width: 22px;
            height: 22px;
            border-radius: 4px;
            border: 2px solid #ccc;
            appearance: none;
            cursor: pointer;
            position: relative;
        }
        .interlock-checkbox:checked {
            background-color: #007bff;
            border-color: #007bff;
        }
        .interlock-checkbox:checked::after {
            content: "✓";
            position: absolute;
            color: white;
            font-size: 16px;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
        }

        /* 动态按键样式 */
        textarea[id^='Key_'] {         
            border-radius: 8px;

            text-align: center !important;
            vertical-align: middle;
            overflow: hidden;
            display: flex;
            align-items: center;
            justify-content: center;
            white-space: pre-wrap;
            word-break: break-word;
            line-height: 1.0;
            padding: 2px 2px;
            margin: 0;
            border: none;
        }

        /* 手机端适配 */
        @media (max-width: 768px) {
            .top-config-panel,
            .template-section,
            #div_RealyState,
            .remote-container,
            #div_Name {
                width: 98%;
                padding: 15px;
                margin-top: 15px;
            }
            .top-config-panel > div {
                flex-direction: column;
                gap: 15px;
            }
            .top-config-panel .col {
                min-width: unset;
                width: 100%;
            }
            .font-24 {
                font-size: 20px;
            }
            .top-config-panel select,
            .top-config-panel input {
                font-size: 18px !important;
                height: 40px !important;
            }
            .key-container {
                transform: scale(0.8);
                transform-origin: top center;
            }
            #div_KeyS {
                min-width: unset;
            }
            .control-panel2 input[type='button'] {
                height: 50px !important;
                font-size: 18px !important;
            }
            #div_Name table td, #div_Name table th {
                font-size: 16px;
                padding: 8px 10px;
            }
            #div_Name table input[type='button'] {
                font-size: 18px !important;
                height: 40px !important;
                padding: 5px 10px !important;
            }
        }