:root {
    --primary-color: #10B981; /* 清新的草绿色 */
    --primary-light: #34D399; /* 浅草绿色 */
    --primary-dark: #059669; /* 深草绿色 */
    --secondary-color: #0EA5E9; /* 清新的天空蓝色 */
    --success-color: #10B981; /* 保持绿色，与主色调统一 */
    --danger-color: #F43F5E; /* 柔和的珊瑚红色 */
    --warning-color: #F59E0B; /* 保持原有橙色 */
    --dark-color: #1E293B; /* 偏蓝的深灰色，更清新 */
    --light-color: #ffffff; /* 白色 */
    --gray-50: #F8FAFC; /* 极浅蓝灰色 */
    --gray-100: #F1F5F9; /* 浅蓝灰色 */
    --gray-200: #E2E8F0; /* 浅灰色带蓝调 */
    --gray-300: #CBD5E1; /* 中灰色带蓝调 */
    --gray-400: #94A3B8; /* 中等蓝灰色 */
    --gray-500: #64748B; /* 蓝灰色 */
    --gray-600: #475569; /* 深蓝灰色 */
    --gray-700: #334155; /* 深蓝灰色 */
    --gray-800: #1E293B; /* 非常深蓝灰色 */
    --gray-900: #0F172A; /* 极深蓝灰色 */
    --border-color: #E2E8F0; /* 浅蓝灰色边框 */
    --panel-width: 380px;
    --transition-speed: 0.3s;
    --shadow-sm: 0 1px 2px rgba(30, 41, 59, 0.05);
    --shadow-md: 0 4px 6px rgba(30, 41, 59, 0.08);
    --shadow-lg: 0 10px 15px rgba(30, 41, 59, 0.1);
    --shadow-xl: 0 20px 25px rgba(30, 41, 59, 0.15);
    --border-radius: 12px;
    --border-radius-lg: 16px;
}


* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

body {
    display: flex;
    min-height: 100vh;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    color: var(--gray-800);
    overflow-x: hidden;
    position: relative;
}

/* 右下角设置按钮 */
.settings-button {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-lg);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 90;
    font-size: 24px;
}

.settings-button:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 10px 20px rgba(99, 102, 241, 0.3);
}

.settings-button:active {
    transform: translateY(-1px) scale(1.02);
}

/* 右侧控制面板 */
.control-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: var(--panel-width);
    height: 100vh;
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: -5px 0 30px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    z-index: 100;
    overflow: hidden;
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-left: 1px solid rgba(0, 0, 0, 0.05);
}

.control-panel.active {
    transform: translateX(0);
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 24px 20px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    box-shadow: 0 2px 10px rgba(99, 102, 241, 0.1);
}

.panel-title {
    font-size: 20px;
    font-weight: 600;
    letter-spacing: -0.3px;
}

.close-button {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 20px;
}

.close-button:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: rotate(90deg);
}

.panel-content {
    flex: 1;
    padding: 20px 24px;
    overflow-y: auto;
}

.panel-section {
    margin-bottom: 28px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--gray-200);
}

.panel-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.section-header {
    display: flex;
    align-items: center;
    margin-bottom: 18px;
}

.section-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    color: white;
    font-size: 18px;
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.2);
}

.section-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--gray-800);
}

.connection-status {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 18px;
    align-items: stretch;
}

.status-group {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    border-radius: var(--border-radius);
    background-color: var(--gray-50);
    border: 1px solid var(--gray-200);
    flex-grow: 1;
    margin-bottom: 5px;
}

/* .left-side 使用 flexbox 布局，使内部元素水平排列 */
.left-side {
    display: flex;
    align-items: center;  /* 确保图标、标签和文本垂直居中 */
    gap: 2px;  /* 给元素之间增加一些间距 */
}

/* .right-side 样式保持不变 */
.right-side {
    display: flex;
    justify-content: flex-end;  /* 让 latency-display 和 channel-info 靠右 */
    gap: 6px;
}

.status-label {
    font-size: 14px;
}

#wsStatusText, #rtcStatusText {
    font-size: 14px;
}


.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 8px;
    background-color: var(--danger-color);
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.1);
}

.status-indicator.connected {
    background-color: var(--success-color);
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.1);
}

.status-indicator.connecting {
    background-color: var(--warning-color);
    animation: pulse 1.5s infinite;
    box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.1);
}


.latency-display,
.channel-info {
    font-size: 12px;
    color: #666;
    font-family: 'Courier New', monospace;
    background: #f5f5f5;
    padding: 2px 2px;
    border-radius: 3px;
    border: 1px solid #ddd;
    display: flex;
    align-items: center;
}

.latency-display.low {
    color: #2ecc71;
    background: #e8f6e8;
    border-color: #2ecc71;
}

.latency-display.medium {
    color: #f39c12;
    background: #fef5e7;
    border-color: #f39c12;
}

.latency-display.high {
    color: #e74c3c;
    background: #fdedec;
    border-color: #e74c3c;
}

/* 通道信息状态样式 - 类似latency-display的颜色分级 */
.channel-info.active {
    color: #2ecc71;
    background: #e8f6e8;
    border-color: #2ecc71;
    font-weight: bold;
}

.channel-info.standby {
    color: #3498db;
    background: #ebf5fb;
    border-color: #3498db;
}

.channel-info.disabled {
    color: #95a5a6;
    background: #f8f9fa;
    border-color: #ecf0f1;
}

.channel-info.error {
    color: #e74c3c;
    background: #fdedec;
    border-color: #e74c3c;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.status-indicator:not(.connected):not(.connecting) {
    background-color: #e74c3c;
    border-color: #c0392b;
}

/* 最近更新的闪烁效果 */
@keyframes blink {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

.channel-info.recent-update {
    animation: blink 1s 3;
}




@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.8;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.connection-controls {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.input-group {
    display: flex;
    flex-direction: column;
}

.input-group label {
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-700);
}

.input-group input {
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid var(--gray-300);
    background-color: var(--light-color);
    color: var(--gray-800);
    font-size: 15px;
    outline: none;
    transition: all var(--transition-speed);
}
.input-group select {
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid var(--gray-300);
    background-color: var(--light-color);
    color: var(--gray-800);
    font-size: 15px;
    outline: none;
    transition: all var(--transition-speed);
    /* 禁用 iOS 默认的下拉样式 */
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;

    /* 添加自定义下拉箭头 */
    background-image: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"%3E%3Cpath d="M4.293 5.293a1 1 0 0 1 1.414 0L8 7.586l2.293-2.293a1 1 0 1 1 1.414 1.414l-3 3a1 1 0 0 1-1.414 0l-3-3a1 1 0 0 1 0-1.414z"%3E%3C/path%3E%3C/svg%3E');
    background-position: right 10px center;
    background-repeat: no-repeat;
    background-size: 12px;

}

.input-group input:focus,
.input-group select:focus{
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

/* 使信息项显示在一行并自动调整大小 */
.mini-info-bar {
    display: flex;
    gap: 6px; /* 设置小条之间的间距 */
    flex-wrap: wrap; /* 如果空间不足时换行 */
    justify-content: flex-start; /* 使内容左对齐 */
}

/* 默认情况下，信息条是灰色的 */
.info-item {
    display: inline-block;
    padding: 4px 6px;  /* 更小的 padding 让信息条更迷你 */
    background-color: #f0f0f0; /* 默认灰色背景 */
    border: 1px solid #ccc;
    border-radius: 4px; /* 圆角 */
    font-size: 10px; /* 更小的字体 */
    color: #333;
    min-width: 60px; /* 设置最小宽度 */
    text-align: center;
    white-space: nowrap; /* 防止文本换行 */
    overflow: hidden;
    text-overflow: ellipsis; /* 文本溢出时显示省略号 */
    flex-shrink: 0; /* 防止缩小 */
}

/* 激活后的背景颜色，显示不同的颜色 */
.info-item.active {
    border-style: solid; /* 边框样式为实线 */
}

/* 为不同的长条设置不同的背景色和边框颜色，帮助区分 */

/* DSU端口激活后的背景色和边框颜色 */
#sessionId.active {
    background-color: #e0f7fa; /* DSU端口激活后的背景色 */
    border-color: #0288d1; /* DSU端口的加深的边框颜色（深蓝色） */
}

/* Session ID 激活后的背景色和边框颜色 */
#slotId.active {
    background-color: #e8f5e9; /* Session ID 激活后的背景色 */
    border-color: #388e3c; /* Session ID 的加深的边框颜色（深绿色） */
}

/* Slot ID 激活后的背景色和边框颜色 */
#dsuPort.active {
    background-color: #fff3e0; /* Slot ID 激活后的背景色 */
    border-color: #f57c00; /* Slot ID 的加深的边框颜色（深橙色） */
}







.button-group {
    display: flex;
    gap: 10px;
}

button {
    padding: 12px 18px;
    border: none;
    border-radius: 10px;
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    flex: 1;
    box-shadow: 0 2px 5px rgba(99, 102, 241, 0.2);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.3);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger-color), #dc2626);
    color: white;
    flex: 1;
    box-shadow: 0 2px 5px rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(239, 68, 68, 0.3);
}

.btn-danger:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-secondary {
    background-color: var(--gray-100);
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
    width: 100%;
}

.btn-secondary:hover {
    background-color: var(--gray-200);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}




/* 体感控制容器 */
.motion-controls {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

/* 通用开关样式 */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

/* 开关组容器 */
.motion-switch-group {
    background: white;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    margin-bottom: 20px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

/* 单个开关项 */
.switch-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s ease;
    cursor: pointer;
}

.switch-item:last-child {
    border-bottom: none;
}

.switch-item:hover {
    background-color: var(--gray-50);
}

.switch-item .switch-info {
    flex: 1;
    margin-right: 16px;
}

.switch-item .switch-label {
    font-weight: 500;
    color: var(--gray-700);
    font-size: 14px;
    display: block;
    margin-bottom: 2px;
}

.switch-item .switch-description {
    font-size: 12px;
    color: var(--gray-500);
    line-height: 1.4;
}

/* 开关样式调整 */
.switch-item .switch {
    width: 48px;
    height: 26px;
}

.switch-item .slider:before {
    height: 18px;
    width: 18px;
}

/* 传感器数据网格样式 */
.sensor-data-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 20px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 1;
    transform: translateY(0);
    overflow: hidden;
    max-height: 500px;
}

.sensor-data-grid.hidden {
    display: none;
    opacity: 0;
    transform: translateY(-10px);
    max-height: 0;
    margin-bottom: 0;
    padding: 0;
}

/* 数据卡片 */
.data-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(248, 250, 252, 0.95));
    padding: 12px 10px;
    border-radius: 10px;
    border-left: 4px solid;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
    position: relative;
    display: flex;
    flex-direction: column;
    height: 70px;
}

.data-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* 陀螺仪数据卡片边框颜色 */
.data-card.gyro-x { border-left-color: #F59E0B; }
.data-card.gyro-y { border-left-color: #8B5CF6; }
.data-card.gyro-z { border-left-color: #0EA5E9; }

/* 加速度计数据卡片边框颜色 */
.data-card.accel-x { border-left-color: #EF4444; }
.data-card.accel-y { border-left-color: #10B981; }
.data-card.accel-z { border-left-color: #3B82F6; }

/* 非激活状态的数据卡片 */
.data-card.inactive-sensor {
    opacity: 0.5;
    background: #F3F4F6;
    border-left-color: #D1D5DB;
    transform: none;
    box-shadow: none;
}

.data-card.inactive-sensor .value-bar-bg {
    background-color: #D1D5DB;
}

/* 数据卡片指示灯 */
.data-card::after {
    content: '';
    position: absolute;
    top: 6px;
    right: 6px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background-color: #D1D5DB; /* 默认灰色 */
    opacity: 0.6;
    transition: all 0.3s ease;
    box-shadow: 0 0 0 0px transparent; /* 初始状态无阴影 */
}

/* 传感器激活状态的指示灯 */
.data-card.active-sensor::after {
    opacity: 1;
}

/* 不同传感器类型的指示灯颜色和阴影 */
.data-card.gyro-x.active-sensor::after {
    background-color: #F59E0B;
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2);
}

.data-card.gyro-y.active-sensor::after {
    background-color: #8B5CF6;
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2);
}

.data-card.gyro-z.active-sensor::after {
    background-color: #0EA5E9;
    box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.2);
}

.data-card.accel-x.active-sensor::after {
    background-color: #EF4444;
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2);
}

.data-card.accel-y.active-sensor::after {
    background-color: #10B981;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

.data-card.accel-z.active-sensor::after {
    background-color: #3B82F6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

/* 传感器未激活时的通用样式 */
.data-card.inactive-sensor::after {
    background-color: #D1D5DB;
    opacity: 0.3;
    box-shadow: none;
}

.data-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.data-label {
    font-size: 10px;
    font-weight: 600;
    color: #4B5563;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.data-label-icon {
    font-size: 11px;
    opacity: 0.8;
}

/* 数值条容器 */
.value-bar-container {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: auto;
    min-height: 24px;
    position: relative;
}

/* 数值条背景 */
.value-bar-bg {
    flex: 1;
    height: 6px;
    background-color: #E5E7EB;
    border-radius: 3px;
    overflow: hidden;
    position: relative;
    /* 添加中间线 */
    background-image: linear-gradient(
        90deg,
        #D1D5DB 1px,
        transparent 1px,
        transparent calc(50% - 0.5px),
        #9CA3AF calc(50% - 0.5px),
        #9CA3AF calc(50% + 0.5px),
        transparent calc(50% + 0.5px),
        transparent 100%
    );
    background-size: 100% 100%;
}

/* 数值条 */
.value-bar {
    position: absolute;
    top: 0;
    height: 100%;
    border-radius: 3px;
    width: 0;
    transition: width 0.01s linear, left 0.01s linear, right 0.01s linear;
    will-change: width, left, right;
    transform: translateZ(0);
}

/* 数值显示 */
.data-value {
    font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
    font-size: 11px;
    font-weight: 700;
    color: #1F2937;
    letter-spacing: -0.1px;
    line-height: 1;
    text-align: right;
    white-space: nowrap;
    min-width: 36px;
    transition: none; /* 移除过渡，立即更新 */
}

/* 数值变化动画 */
.data-value.changing {
    animation: quickFlash 0.08s ease;
}

@keyframes quickFlash {
    0% { opacity: 0.9; }
    50% { opacity: 1; }
    100% { opacity: 0.9; }
}


/* 响应式调整 */
@media (max-width: 768px) {
    .sensor-data-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }

    .data-card {
        padding: 10px 8px;
        height: 66px;
    }

    .data-value {
        font-size: 10px;
        min-width: 32px;
    }

    .value-bar-bg {
        height: 5px;
    }

    .switch-item {
        padding: 14px 16px;
    }

    .switch-item .switch {
        transform: scale(0.9);
    }

    .switch-item .switch-info {
        margin-right: 12px;
    }
}



/* 方向选择器 */
.orientation-selector {
    width: 100%;
}

.orientation-label {
    display: block;
    margin-bottom: 12px;
    font-weight: 500;
    color: var(--gray-700);
}

/* 正面/背面选项容器 */
.face-orientation-options {
    display: flex;
    gap: 12px;
    width: 100%;
    margin-bottom: 20px;
}

/* 旋转方向选项容器 */
.rotation-orientation-options {
    display: flex;
    gap: 12px;
    width: 100%;
}

/* 通用选项样式 */
.face-orientation-item,
.rotation-orientation-item {
    flex: 1;
    min-width: 0;
    background-color: var(--gray-50);
    border: 2px solid var(--gray-200);
    border-radius: var(--border-radius);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    padding: 15px 5px;

}

/* 调整正面/背面选项的高度 */
.face-orientation-item {
    height: 110px;
}

/* 旋转方向选项保持原有高度 */
.rotation-orientation-item {
    height: 80px;
}

/* 只在支持悬停的设备上应用hover效果 */
@media (hover: hover) and (pointer: fine) {
    .face-orientation-item:hover,
    .rotation-orientation-item:hover {
        transform: translateY(-2px);
        background-color: white;
        box-shadow: var(--shadow-md);
        border-color: var(--gray-300);
    }
}

.face-orientation-item.active,
.rotation-orientation-item.active {
    transform: scale(0.95);
    border-color: var(--primary-color);
    background-color: white;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}


/* 移动端的点击反馈 */
@media (hover: none) and (pointer: coarse) {
    .face-orientation-item:active,
    .rotation-orientation-item:active {
        transform: scale(0.98);
    }
}

/* 图标容器 - 正面/背面更大 */
.face-orientation-icon {
    width: 50px;
    height: 50px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: visible;
}

/* 旋转方向图标容器保持原有大小 */
.rotation-orientation-icon {
    width: 28px;
    height: 28px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 正面/背面SVG图标 */
.face-orientation-icon svg {
    width: 100%;
    height: 100%;
    color: var(--gray-500);
}

/* 旋转方向SVG图标 */
.rotation-orientation-icon svg {
    width: 24px;
    height: 24px;
    fill: var(--gray-500);
}

/* 激活状态的图标颜色 - 修复选择器 */
.face-orientation-item.active .face-orientation-icon svg {
    color: var(--primary-color) !important;
}

.rotation-orientation-item.active .rotation-orientation-icon svg {
    fill: var(--primary-color) !important;
}

/* 文字样式 */
.orientation-text {
    font-size: 12px;
    font-weight: 500;
    color: var(--gray-600);
    text-align: center;
    line-height: 1.3;
    margin-top: 4px;
}

.face-orientation-item.active .orientation-text,
.rotation-orientation-item.active .orientation-text {
    color: var(--primary-color);
    font-weight: 600;
}

/* 滑动样式 */
.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--gray-300);
    transition: .3s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

input:checked + .slider {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
}

input:checked + .slider:before {
    transform: translateX(24px);
}

.slider-container {
    display: flex;
    flex-direction: column;
    margin-top: 5px;
}

.slider-container label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--gray-700);
}

.range-slider {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(to right, var(--gray-200), var(--gray-400));
    outline: none;
}

.range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
}

.range-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
}

.range-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    border: none;
}

.slider-value {
    font-size: 12px;
    color: var(--gray-500);
    margin-top: 6px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

/* 布局管理部分 */
.layout-controls {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.layout-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.layout-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px 8px;
    background-color: var(--gray-50);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.layout-option:hover {
    transform: translateY(-3px);
    background-color: white;
    box-shadow: var(--shadow-md);
}

.layout-option.active {
    border-color: var(--primary-color);
    background-color: white;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.1);
}

.layout-icon {
    width: 44px;
    height: 44px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(99, 102, 241, 0.08);
    border-radius: 10px;
    color: var(--primary-color);
    font-size: 22px;
}

.layout-name {
    font-size: 12px;
    font-weight: 500;
    text-align: center;
    color: var(--gray-700);
}

/* Joy-Con 容器样式调整 */
.joycon-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px;
    transition: all var(--transition-speed);
}

#joyconWrapper {
    display: flex;
    gap: 40px;
    transition: all var(--transition-speed);
}

/* 状态消息 */
.status-message {
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 13px;
    margin-top: 10px;
    display: none;
    line-height: 1.5;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

.status-message.success {
    background-color: rgba(16, 185, 129, 0.08);
    border-left: 3px solid var(--success-color);
    display: block;
    color: var(--gray-800);
}

.status-message.error {
    background-color: rgba(239, 68, 68, 0.08);
    border-left: 3px solid var(--danger-color);
    display: block;
    color: var(--gray-800);
}

.status-message.info {
    background-color: rgba(99, 102, 241, 0.08);
    border-left: 3px solid var(--primary-color);
    display: block;
    color: var(--gray-800);
}

/* 面板底部 */
.panel-footer {
    padding: 16px 24px;
    text-align: center;
    font-size: 12px;
    color: var(--gray-500);
    border-top: 1px solid var(--gray-200);
    background-color: var(--gray-50);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .control-panel {
        width: 100%;
        transform: translateX(100%);
    }

    .settings-button {
        bottom: 20px;
        right: 20px;
        width: 50px;
        height: 50px;
        font-size: 22px;
    }

    .joycon-container {
        padding: 20px 10px;
    }

    #joyconWrapper {
        flex-direction: column;
        gap: 20px;
    }

    .layout-options {
        grid-template-columns: 1fr;
    }
}

/* 面板遮罩 */
.panel-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(2px);
    z-index: 99;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.panel-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* 图标间距调整 */
button .material-icons, .slider-value .material-icons {
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 连接状态图标 */
.connection-status .material-icons {
    margin-right: 8px;
    font-size: 16px;
}

/* 滚动条样式 */
.panel-content::-webkit-scrollbar {
    width: 6px;
}

.panel-content::-webkit-scrollbar-track {
    background: transparent;
}

.panel-content::-webkit-scrollbar-thumb {
    background-color: var(--gray-300);
    border-radius: 3px;
}

.panel-content::-webkit-scrollbar-thumb:hover {
    background-color: var(--gray-400);
}

/* 输入框和按钮的聚焦状态 */
.input-group input:focus,
button:focus {
    outline: none;
}

/* 按钮图标大小统一 */
.btn-primary .material-icons,
.btn-danger .material-icons,
.btn-secondary .material-icons {
    font-size: 18px;
}

/* 滑动条标签样式优化 */
.slider-container label span:first-child {
    color: var(--gray-700);
}

.slider-container label span:last-child {
    color: var(--primary-color);
    font-weight: 600;
}

.status-indicator.connected {
    background: #22c55e;
    box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.15);
}

.status-indicator.disconnected {
    background: #9ca3af;
    box-shadow: none;
}