/* CSS变量定义 */
:root {
    --bg-primary: #f2f3f5; /* 页面主要背景色 */
    --bg-secondary: #ffffff; /* 次要背景色，通常用于卡片或内容区域 */
    --text-primary: #333333; /* 主要文字颜色 */
    --text-secondary: #666666; /* 次要文字颜色 */
    --border-color: #ddd; /* 边框颜色 */
    --shadow-color: rgba(0,0,0,0.15); /* 阴影颜色 */
    --hover-bg: #f5f5f5; /* 鼠标悬停时的背景色 */
    --primary-color: #d2b16f; /* 主题色 */
}

/* 深色模式变量 */
body.dark-mode {
    --bg-primary: #2c2c2c; /* 深色模式下的页面主要背景色 */
    --bg-secondary: #3c3c3c; /* 深色模式下的次要背景色 */
    --text-primary: #ffffff; /* 深色模式下的主要文字颜色 */
    --text-secondary: #cccccc; /* 深色模式下的次要文字颜色 */
    --border-color: #555; /* 深色模式下的边框颜色 */
    --shadow-color: rgba(0,0,0,0.3); /* 深色模式下的阴影颜色 */
    --hover-bg: #4c4c4c; /* 深色模式下的鼠标悬停背景色 */
    --primary-color: #d2b16f; /* 深色模式下的主题色 */
}

/* 深色模式下的文字颜色 */
body.dark-mode .label-item,
body.dark-mode .global-gain-label {
    color: #ffffff !important;
}

/* 深色模式下的输入框样式 */
body.dark-mode .gain-input,
body.dark-mode .freq-input,
body.dark-mode .q-input,
body.dark-mode .global-gain-input {
    background-color: #2c2c2c !important;
    color: #ffffff !important;
    border: 1px solid #555 !important;
}

/* 深色模式下的滑块样式 */
/* 夜间模式下滑杆保持原本的背景色，确保可见性 */
body.dark-mode .gain-slider,
body.dark-mode .global-gain-slider {
    background: rgba(255,255,255,0.2) !important;
}

body.dark-mode .gain-slider::-webkit-slider-track,
body.dark-mode .global-gain-slider::-webkit-slider-track {
    background: transparent !important; /* 保持透明背景 */
    border: 1px solid #c4c1c1d2 !important; /* 保持边框可见 */
}

body.dark-mode .gain-slider::-webkit-slider-thumb,
body.dark-mode .global-gain-slider::-webkit-slider-thumb {
    background: white !important; /* 滑块保持白色 */
    border: 2px solid #d2b16f !important; /* 保持边框颜色 */
}

body.dark-mode .gain-slider::-moz-range-track,
body.dark-mode .global-gain-slider::-moz-range-track {
    background: transparent !important; /* 保持透明背景 */
    border: 1px solid #c4c1c1d2 !important; /* 保持边框可见 */
}

body.dark-mode .gain-slider::-moz-range-thumb,
body.dark-mode .global-gain-slider::-moz-range-thumb {
    background: white !important; /* 滑块保持白色 */
    border: 2px solid #d2b16f !important; /* 保持边框颜色 */
}

/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    background-color: var(--bg-primary); /* 调整为原版的背景色 */
    color: var(--text-primary);
    transition: all 0.3s ease;
}

/* 顶部导航栏 */
.top-header {
    background: #2094f8; /* 顶部导航栏背景色 */
    color: white; /* 文字颜色 */
    padding: 8px 16px 4px; /* 再次从下边收缩并略降整体 */
    display: flex;
    justify-content: space-between; /* 改为两端对齐 */
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1); /* 阴影颜色 */
}

/* 顶部左侧标题（Xmos设备EQ调试界面）
   - 左对齐：通过父容器的space-between布局自然处于左侧
   - 字号：20px（满足“字号20px”的要求）
   - 加粗：font-weight: 700（满足“加粗”的要求） */
.site-title {
    font-size: 20px; /* 标题字号 */
    font-weight: 700; /* 标题加粗 */
    color: #fff; /* 标题文字颜色，与顶部导航一致 */
    line-height: 1.2; /* 稍微增大行高以更好垂直居中 */
    margin-right: 12px; /* 与中间导航保持一定间距 */
    display: flex; /* 使内容与顶部行垂直居中对齐 */
    align-items: center; /* 垂直居中 */
}

.site-logo {
    height: 30px;
    width: auto;
    margin-right: 10px;
    display: block;
}
.title-sep {
    display: inline-block;
    width: 2px;
    height: 30px;
    background: currentColor; /* 分隔符背景色（跟随当前文字颜色） */
    margin: 0 6px;
}

.top-nav {
    display: flex;
    gap: 30px;
    flex: 1;
    justify-content: center; /* 保持导航项居中 */
}

.nav-item {
    color: white;
    text-decoration: none;
    padding: 5px 12px; /* 再降标签高度 */
    border-radius: 4px;
    transition: all 0.3s;
    font-weight: 500;
    font-size: 13px; /* 字体略小 */
}

.nav-item:hover {
    background: rgba(255,255,255,0.1);
}

.nav-item.active {
    background: rgba(255,255,255,0.2);
}

/* 右侧控制区域 */
.nav-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

.control-item {
    position: relative;
}

/* 连接和翻译按钮样式 */
.connect-btn, .translate-btn {
    background: rgba(255,255,255,0.1);
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s;
}

.connect-btn:hover, .translate-btn:hover {
    background: rgba(255,255,255,0.2);
}

/* 翻译按钮改为图标样式（无边框无背景） */
.translate-btn {
    background: none !important;
    border: none !important;
    padding: 0 !important;
}
.translate-btn:hover {
    background: none !important;
}
.translate-btn .lang-icon {
    display: inline-block;
    width: 24px;
    height: 24px;
    color: black;
}
body.dark-mode .translate-btn .lang-icon {
    color: white;
}

/* 悬停时显示语言下拉 */
.control-item:hover #languageDropdown {
    display: block;
}

/* 下拉菜单样式 */
.dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    z-index: 1000;
    display: none;
    margin-top: 2px;
}

.dropdown.show {
    display: block;
}

.dropdown-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    box-shadow: 0 2px 8px var(--shadow-color);
    min-width: 120px;
}

.dropdown-item {
    padding: 8px 12px;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 12px;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.3s;
}

.dropdown-item:last-child {
    border-bottom: none;
}

.dropdown-item:hover {
    background: var(--hover-bg);
}

.dropdown-item.selected {
    background: rgba(102, 126, 234, 0.1); /* 下拉项选中背景色 */
    color: #d2b16f; /* 下拉项选中文字颜色 */
}

/* 主题切换开关样式 */
.theme-switch {
    position: relative;
}

.theme-toggle {
    display: none;
}

.theme-label {
    display: block;
    width: 40px;
    height: 20px;
    background: rgba(255,255,255,0.3); /* 切换开关轨道背景色 */
    border-radius: 20px;
    cursor: pointer;
    position: relative;
    transition: all 0.3s;
}

.theme-slider {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: white; /* 切换开关滑块颜色 */
    border-radius: 50%;
    transition: all 0.3s;
}

.theme-toggle:checked + .theme-label {
    background: rgba(255,255,255,0.5); /* 切换开关激活状态轨道背景色 */
}

.theme-toggle:checked + .theme-label .theme-slider {
    transform: translateX(20px);
}

/* 主容器 */
.main-container {
    display: flex;
    height: calc(100vh - 60px);
}

/* 左侧导航栏 */
.sidebar {
    width: 220px;
    background: var(--bg-secondary);
    padding: 20px 0;
    border-right: 1px solid var(--border-color);
}

.sidebar h2 {
    padding: 0 20px 20px;
    font-size: 18px;
    color: var(--text-secondary);
    text-align: center;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
}

.sidebar-item {
    padding: 12px 20px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.3s;
    border-left: 3px solid transparent;
    text-align: center;
}

.sidebar-item.active {
    background: #2094f8; /* 侧边栏选中项背景色 */
    color: white; /* 选中项文字颜色 */
    border-left-color: #2094f8; /* 选中项左侧指示条颜色 */
}

.sidebar-item:hover:not(.active) {
    background: var(--hover-bg);
}

/* 主要内容区域 */
.main-content {
    flex: 1;
    padding: 11px;
    overflow-y: auto;
    overflow-x: auto;
}

/* EQ控制区域顶部 */
.eq-header {
    margin-bottom: 7px;
    align-self: stretch;
}

.eq-controls-top {
    display: flex;
    align-items: center;
    justify-content: flex-end; /* 右对齐 */
    gap: 20px; /* 增加间距 */
    padding: 7px 16px 3px;
    /*background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%); /* 添加渐变背景 */
    /*border-radius: 10px; /* 增加圆角 */
    /*box-shadow: 0 2px 8px rgba(0,0,0,0.1); /* 添加柔和阴影 */
    font-size: 14px; /* 稍微增大字体 */
    /*border: 1px solid #dee2e6; /* 添加边框 */
}

/* EQ开关样式 */
.eq-switch {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.eq-switch input {
    display: none;
}

.slider {
    width: 50px;
    height: 20px; /* 缩小开关高度 */
    background: #ccc; /* 开关关闭时的背景色 */
    border-radius: 10px;
    position: relative;
    transition: background 0.3s;
}

.slider::before {
    content: '';
    position: absolute;
    width: 16px; /* 配合更低的高度 */
    height: 16px;
    background: white; /* 开关滑块颜色 */
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: transform 0.3s;
}

.eq-switch input:checked + .slider {
    background: #d2b16f; /* EQ开关开启时的背景色 */
}

.eq-switch input:checked + .slider::before {
    transform: translateX(30px); /* 依据宽50、圆16、左右边距各2px */
}

/* 夜间模式下保存和重置按钮的样式 */
body.dark-mode .save-btn,
body.dark-mode .reset-btn {
    background: #2c2c2c !important; /* 夜间模式下按钮背景色 */
    color: white !important; /* 夜间模式下按钮文字颜色 */
    border: 1px solid #555 !important; /* 夜间模式下按钮边框颜色 */
}

body.dark-mode .save-btn:hover,
body.dark-mode .reset-btn:hover {
    background: #3c3c3c !important; /* 夜间模式下按钮悬停背景色 */
}

.save-btn, .reset-btn {
    padding: 4px 10px; /* 再降按钮高度 */
    border: 1px solid #ddd;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 13px; /* 字体缩小 */
    display: inline-flex; align-items: center; /* 行内垂直居中 */
}

.save-btn:hover, .reset-btn:hover {
    background: #f5f5f5;
}

/* EQ图形显示区域 */
.eq-graph-container {
    display: flex;
    background: transparent; /* 完全透明背景 */
    border: none; /* 无边框 */
    border-radius: 0; /* 无圆角 */
    padding: 11px;
    margin-bottom: 11px;
    box-shadow: none; /* 无阴影 */
    margin-left: auto;
    margin-right: auto;
}

.eq-graph {
    flex: 0 0 auto;
    position: relative;
    width: 1438px;
}

#eqCanvas {
    width: 1438px;
    height: 315px;
    border: none; /* 无边框 */
    background: transparent; /* 透明背景 */
}

/* 节点图层样式 - 始终在最上层 */
.node-layer {
    position: absolute;
    top: 0; /* 无边框时贴合画布 */
    left: 0; /* 无边框时贴合画布 */
    width: 100%;
    height: 100%;
    pointer-events: none; /* 允许点击穿透到canvas */
    z-index: 10; /* 确保在最上层 */
}

/* 节点样式 */
.control-node {
    touch-action: none; /* 防止移动端拖拽时触发滚动 */
    position: absolute;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #888888; /* 节点默认背景色 */
    border: none; /* 无轮廓 */
    outline: none; /* 无焦点轮廓 */
    box-shadow: none; /* 无阴影边界 */
    cursor: pointer;
    pointer-events: auto; /* 节点本身可以接收点击事件 */
    transform: translate(-50%, -50%); /* 居中对齐 */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: bold;
    color: white; /* 节点内数字颜色 */
    user-select: none;
}

/* 点击（选中）后变色 */
.control-node.active {
    background: #d2b16f; /* 节点选中时的背景色 */
}

/* 悬停不变色且无阴影（避免） */
.control-node:hover {
    background: #d2b16f; /* 节点悬停时的背景色 */
    box-shadow: none;
}

.frequency-labels {
    position: relative;
    height: 18px;
    margin-top: 5px;
    font-size: 12px;
    color: #666;
}
.frequency-labels span {
    position: absolute;
    transform: translateX(-50%);
    white-space: nowrap;
}

/* 全局增益控件样式 */
.global-gain-control {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between; /* 顶/底分布，填满可见高度 */
    margin-right: 20px;
    padding: 10px;
    background: transparent; /* 透明背景 */
    border-radius: 0; /* 无圆角 */
    border: none; /* 无边框 */
    min-width: 140px;
    flex: 0 0 140px;
    height: 340px; /* 保持大小与位置不变 */
}




/* 数值框靠近底部 */
.global-gain-control .number-input-wrap { margin-top: 4px; width: 72px; }
.global-gain-label {
    font-size: 18px; /* 放大到18px */
    font-weight: bold;
    color: #333; /* 标签文字颜色 */
    margin-bottom: 10px;
    text-align: center;
    margin-left: -10px; /* 向左移动约10px，仅标题 */
}


/* 全局增益右侧刻度列 */
.global-gain-scale {
    height: 235px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: flex-start;
    width: 32px;
    color: #888888; /* 刻度文字颜色 */
    pointer-events: none;
}
.global-gain-scale .scale-label { font-size: 11px; line-height: 1; }

.global-gain-slider-container {
    height: 235px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 5px;
    gap: 8px;
}

/* 滑杆通用样式 */
.global-gain-slider,
.gain-slider {
    touch-action: none; /* 防止移动端拖拽时触发滚动 */
    -webkit-appearance: none; /* 彻底移除WebKit默认样式 */
    -moz-appearance: none; /* 彻底移除Firefox默认样式 */
    appearance: none; /* 彻底移除所有浏览器默认样式 */
    position: relative; /* 为伪元素定位提供参考 */
    width: 5px; /* 缩小一半，与红色阴影宽度一致 */
    background: rgba(128,128,128,0.2); /* 滑杆轨道背景色 */
    outline: none; /* 移除默认轮廓 */
    border-radius: 5px; /* 相应缩小圆角 */
    border: none; /* 去除滑杆轮廓 */
    /* 垂直滑杆设置 - 修复方向 */
    writing-mode: bt-lr; /* IE */
    -webkit-writing-mode: vertical-rl; /* WebKit - 改为rl修复方向 */
    writing-mode: vertical-rl; /* 标准 - 改为rl修复方向 */
    direction: rtl; /* 反转方向，使滑块移动与阴影变化一致 */
}

.global-gain-slider {
    height: 235px; /* 恢复原来的高度设置 */
}

.gain-slider {
    height: 180px; /* 恢复原来的高度设置 */
    margin-top: -5px; /* 保持底部基线不变，向上延展 */
}

/* 滑杆轨道样式 - WebKit */
.global-gain-slider::-webkit-slider-track,
.gain-slider::-webkit-slider-track {
    -webkit-appearance: none;
    appearance: none;
    background: transparent; /* 移除默认背景，避免与自定义阴影冲突 */
    border-radius: 5px;
    border: 1px solid #888888; /* 轨道边框颜色 */
}

/* 滑杆轨道样式 - Firefox */
.global-gain-slider::-moz-range-track,
.gain-slider::-moz-range-track {
    background: transparent; /* 移除默认背景 */
    border-radius: 5px;
    border: 1px solid #888888; /* 轨道边框颜色 */
}

/* 滑杆阴影部分样式 - 使用CSS变量控制 */
.global-gain-slider::before,
.gain-slider::before {
    content: '';
    position: absolute;
    background: #d2b16f; /* 滑杆填充条颜色 */
    border-radius: 5px;
    width: calc(50% + 5px); /* 在原来50%基础上增加5px */
    left: calc(25% - 2.5px); /* 相应调整左边距以保持居中 */
    height: var(--slider-bar-height, 0%);
    bottom: var(--slider-bar-bottom, 0%);
    pointer-events: none;
    z-index: 1;
}

/* 滑块样式 - WebKit */
.global-gain-slider::-webkit-slider-thumb,
.gain-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    border-radius: 50%;
    cursor: pointer;
    position: relative;
    z-index: 2;
    border: 2px solid #d2b16f; /* 滑块边框颜色 */
    background: white; /* 滑块背景色 */
    /* 去掉阴影效果 */
}

.global-gain-slider::-webkit-slider-thumb {
    width: 20px; /* 增大2px半径，从20px到24px */
    height: 20px;
}

.gain-slider::-webkit-slider-thumb {
    width: 18px; /* 增大2px半径，从16px到20px */
    height: 18px;
}

/* 滑块样式 - Firefox */
.global-gain-slider::-moz-range-thumb,
.gain-slider::-moz-range-thumb {
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid #d2b16f; /* 滑块边框颜色 */
    background: white; /* 滑块背景色 */
    /* 去掉阴影效果 */
}

.global-gain-slider::-moz-range-thumb {
    width: 20px; /* 半径 */
    height: 20px;
}

.gain-slider::-moz-range-thumb {
    width: 18px; /* 半径 */
    height: 18px;
}

/* 新增：全局增益数值输入样式 */
.global-gain-input {
    width: 102px; /* 向左拉宽30px */
    position: relative; /* 使left偏移生效 */
    left: -30px; /* 保持右缘不动，向左扩展30px */
    height: 30px;
    padding: 4px 6px;
    padding-right: 28px; /* 为空心内置▲▼预留空间 */
    border: 1px solid #ddd;
    border-radius: 3px;
    text-align: center;
    font-size: 13px;
}
.global-gain-control .number-input-wrap { margin-top: 4px; width: 72px; }
.gain-labels {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    margin-left: 0;
    margin-right: 10px;
    font-size: 12px;
    color: #666;
    height: 315px;
    padding: 5px 0;
}

/* EQ控制面板样式 - 重新设计 */
.eq-controls-panel {
    background: transparent; /* 完全透明背景 */
    border: none; /* 无边框 */
    border-radius: 0; /* 无圆角 */
    padding: 11px;
    box-shadow: none; /* 无阴影 */
    display: flex;
    gap: 12px;
    margin-top: -20px; /* 整体位置下移10px */
    width: 1680px;
    height: 419px;
    box-sizing: border-box;
    margin-left: auto;
    margin-right: auto;
}

/* 日间模式：背景元素文字颜色调整 */
body:not(.dark-mode) .top-header .site-title,
body:not(.dark-mode) .top-header .nav-item,
body:not(.dark-mode) .top-header .connect-btn,
body:not(.dark-mode) .top-header .translate-btn {
    color: #000 !important;
}
body:not(.dark-mode) .sidebar-item.active { color: #000 !important; }
/* body:not(.dark-mode) .band-number { color: #000 !important; } */
/* body:not(.dark-mode) .filter-btn.active { color: #000 !important; } */

/* 夜间模式：网格与刻度数字变为灰白 */
body.dark-mode .frequency-labels { color: #d0d0d0 !important; }
body.dark-mode .gain-labels { color: #d0d0d0 !important; }
body.dark-mode .global-gain-scale { color: #d0d0d0 !important; }
body.dark-mode .band-gain-scale { color: #d0d0d0 !important; }

.control-labels {
    display: flex;
    flex-direction: column;
    gap: 8px; /* 与右侧内容区 gap 保持一致，便于行对齐 */
    min-width: 64px;
    padding-top: 35px;
}

.label-item {
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: #333; /* 标签文字颜色 */
    background: transparent; /* 透明背景 */
    border: 1px dashed #999; /* 虚线轮廓 */
    border-radius: 4px;
    font-size: 14px;
}

/* 左侧标题列：还原"类型"高度，并下移后三项 */
.control-labels .label-item:nth-child(1) { height: 185px; }
.control-labels .label-item:nth-child(2),
.control-labels .label-item:nth-child(3),
.control-labels .label-item:nth-child(4) { 
    height: 30px; 
    line-height: 33px; 
    margin-top: 2px; 
    transform: translateY(25px);
}

.eq-bands {
    display: grid;
    grid-template-columns: repeat(8, minmax(160px, 1fr)); /* 8列布局，增加最小宽度 */
    gap: 11px;
    padding: 15px;
    background: transparent; /* 透明背景 */
    border-radius: 0; /* 去掉圆角 */
    box-shadow: none; /* 去掉阴影 */
    border: none; /* 去掉边框 */
    min-width: 1300px; /* 增加最小宽度 */
    margin-bottom: 15px;
    flex: 1;
    align-items: stretch;
}

.eq-band {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: transparent; /* 透明背景 */
    border: none; /* 去掉边框 */
    border-radius: 0; /* 去掉圆角 */
    padding: 11px;
    box-shadow: none; /* 去掉阴影 */
    transition: all 0.3s ease; /* 添加过渡效果 */
    min-width: 160px; /* 增加最小宽度 */
}

.eq-band:hover {
    transform: none; /* 去掉悬停效果 */
    box-shadow: none; /* 去掉悬停阴影 */
    border-color: transparent; /* 去掉悬停边框 */
}

.band-number {
    background: #d2b16f; /* 频段编号背景色 */
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 12px;
    margin-bottom: 5px;
}

.band-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

/* 顶部：类型 + 滑块 左右对齐 */
.type-gain-row {
    height: 185px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
}

.filter-types {
    display: grid;
    grid-template-columns: 1fr; /* 单列布局 */
    gap: 4px;
    width: 40px; /* 调整宽度 */
    flex: 0 0 40px;
    margin-left: 8px;
}

.filter-btn {
    background: linear-gradient(to bottom, #eeeeee, #aaaaaa); /* 滤波器按钮默认背景 */
    border: 1px solid #ccc; /* 按钮边框颜色 */
    padding: 2px 4px; /* 按钮尺寸 */
    font-size: 10px; /* 字体大小 */
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.2s;
    color: #666; /* 按钮文字颜色 */
    min-height: 20px; /* 设置最小高度 */
    display: flex;
    align-items: center;
    justify-content: center;
}

.filter-btn:hover {
    background: linear-gradient(to bottom, #f0f0f0, #d8d8d8); /* 悬停时稍深的渐变 */
}

.filter-btn.active {
    background: #d2b16f;  /* 滤波器按钮选中背景色 */
    color: white; /* 字体颜色 */
    border-color: #d2b16f; /* 边框色 */
}

/* 滑块与刻度组合容器 */
.slider-with-scale {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 28px; /* 滑杆位置28px */
    margin-top: 0; /* 取消下移，保持底部基线不变 */
}
/* 左侧刻度列（对齐原版） */
.band-gain-scale {
    height: 185px; /* 向上拉高约5px */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: flex-start;
    width: 32px;
    color: #888; /* 刻度文字颜色 */
    pointer-events: none;
    margin-top: -5px; /* 保持底部基线不变，向上延展 */
}
.band-gain-scale .scale-label {
    font-size: 11px;
    line-height: 1;
}
/* 调整顶部行滑块容器宽度，容纳刻度+滑杆 */
.type-gain-row .gain-slider-container {
    width: 84px;
}

.gain-slider-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    width: 100%;
}

.gain-value {
    font-size: 11px;
    font-weight: bold;
    color: #d2b16f; /* 增益数值颜色 */
    margin-top: 4px;
    text-align: center;
    min-height: 16px;
}

/* 新增：增益输入行（与频率/Q对齐） */
.gain-input-section,
.freq-section,
.q-section {
    height: 38px; /* 行高略增以配合更高的输入框 */
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 0;
}

/* 数值输入框尺寸加大 */
.gain-input,
.freq-input,
.q-input {
    width: 140px; /* 宽度140px */
    height: 32px; /* 高度32px */
    padding: 4px 6px;
    padding-right: 28px; /* 为空心内置▲▼预留空间 */
    border: 1px solid #fcfcfc;
    border-radius: 3px;
    text-align: center;
    font-size: 13px;
}

/* 始终显示 number 输入的微调箭头（WebKit/Chromium） */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
input[type="number"] { appearance: textfield; -moz-appearance: textfield; }

/* 彻底禁用外部箭头样式占位 */
.control-arrows, .arrow-btn { display: none !important; width: 0; height: 0; overflow: hidden; }

/* 自定义：输入框内置上下箭头（更易点击） */
.number-input-wrap { position: relative; display: inline-block; }
.number-input-wrap .custom-spinner {
    position: absolute;
    top: 1px;
    right: 1px;
    bottom: 1px;
    width: 28px; /* 与输入框右侧预留空间一致 */
    height: auto;
    display: flex;
    flex-direction: column;
    border: 1px solid #e4e7ed; /* 调整按钮边框颜色 */
    border-radius: 0 3px 3px 0; /* 右侧上/下圆角贴合输入框 */
    overflow: hidden;
    background: transparent;
}
.custom-spinner .spinner-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
    background: transparent;
    font-size: 0; /* 隐藏任何残留文本（▲/▼） */
    color: transparent;
    line-height: 0;
}
.custom-spinner .spinner-btn + .spinner-btn { border-top: 1px solid #e4e7ed; }
/* 禁用旧的伪元素折线，改用SVG三角描边 */
.custom-spinner .spinner-btn::before { content: none !important; }
.custom-spinner .spinner-btn svg { width: 12px; height: 12px; display: block; }
.custom-spinner .spinner-btn:hover { background: #f5f7fa; }
.custom-spinner .spinner-btn:hover svg path { stroke: #2d3238; /* 箭头悬停颜色 */ }

/* 模式锁定时的指针样式（仅作用于首页EQ区域，不影响设备页） */
.preset-locked #homePage .control-node,
.preset-locked #homePage .gain-slider,
.preset-locked #homePage .global-gain-slider,
.preset-locked #homePage .gain-input,
.preset-locked #homePage .freq-input,
.preset-locked #homePage .q-input,
.preset-locked #homePage .global-gain-input,
.preset-locked #homePage .custom-spinner .spinner-btn,
.preset-locked #homePage .filter-btn {
    cursor: not-allowed !important;
}
.preset-locked #homePage .gain-slider::-webkit-slider-thumb,
.preset-locked #homePage .global-gain-slider::-webkit-slider-thumb {
    cursor: not-allowed !important;
}
.preset-locked #homePage .gain-slider::-moz-range-thumb,
.preset-locked #homePage .global-gain-slider::-moz-range-thumb {
    cursor: not-allowed !important;
}

/* 响应式设计 - 合并所有重复的媒体查询 */
@media (max-width: 1200px) {
    .eq-bands {
        grid-template-columns: repeat(8, minmax(160px, 1fr));
    }
    
    .eq-band {
        min-width: 160px;
    }
}

@media (max-width: 768px) {
    .main-container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
    }
    
    .sidebar-nav {
        flex-direction: row;
        overflow-x: auto;
    }
    
    .eq-controls-panel {
        flex-direction: column;
    }
    
    .control-buttons {
        flex-direction: row;
        margin-bottom: 20px;
    }
}

/* 页面内容样式 */
.page-content {
    width: 100%;
    height: 100%;
}

.page-content#homePage {
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* 设备页面样式 */
.device-container {
    padding: 2rem;
    width: 1200px;
    min-width: 1200px;
    max-width: none;
    margin: 0 auto;
}

.device-section {
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 32px;
}

.device-section-title-wrapper {
    flex: 0 0 140px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.device-mode-title-wrapper {
    flex-direction: column;
    justify-content: space-between;
    align-items: flex-start;
    height: 120px;
}

.device-mode-title-wrapper .eq-switch span {
    font-size: 1.4rem;
    font-weight: 400;
    color: var(--text-primary);
}

.device-section-title {
    font-size: 1.4rem;
    color: var(--text-primary);
}

.device-section-main {
    flex: 1;
}

.device-status-info {
    text-align: center;
}

.device-status-info h3 {
    font-size: 1.2rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.device-status-info p {
    font-size: 1rem;
    color: var(--text-secondary);
}

.device-sample-format {
    margin-top: 0.3rem;
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.device-control-row {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.device-control-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1.2rem 1.6rem;
    min-width: 260px;
    border: 2px solid var(--border-color);
    box-shadow: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-sizing: border-box;
}

.ex3d-container {
    max-height: calc(100vh - 120px);
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: relative;
    left: -150px;
}

.ex3d-section {
    margin-bottom: 12px;
}

.device-section.ex3d-section {
    justify-content: flex-start;
}

.ex3d-section .device-section-title-wrapper {
    flex: 0 0 220px;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 10px;
}

.ex3d-engine-switch span {
    font-size: 0.95rem;
    color: var(--text-primary);
}

.ex3d-control-row {
    justify-content: flex-start;
    margin-top: 0.9rem;
}

.ex3d-angle-volume-row {
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 18px;
    width: 1100px;
}

.ex3d-group-card {
    flex: 1;
}

.ex3d-param-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

.ex3d-param-row {
    display: grid;
    grid-template-columns: 200px 260px 130px;
    align-items: center;
    gap: 12px;
}

.ex3d-limiter-card .ex3d-param-row {
    grid-template-columns: 200px 260px 130px;
}

.ex3d-param-label {
    font-size: 0.95rem;
    color: var(--text-primary);
}

.ex3d-slider {
    width: 100%;
}

.ex3d-number-wrap {
    width: 110px;
    display: block;
}

.ex3d-number {
    width: 110px;
    box-sizing: border-box;
}

.ex3d-playback-card {
    min-width: 260px;
}

.ex3d-select {
    width: 260px;
}

.ex3d-playback-plain {
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
}

.ex3d-playback-select {
    width: 140px;
}

.ex3d-meter-card {
    width: 100%;
}

.ex3d-channels-row {
    align-items: stretch;
    gap: 18px;
}

.ex3d-middle-layer-card {
    flex: 0 0 auto;
    min-width: 420px;
}

.ex3d-angle-card {
    flex: 0 1 62%;
    min-width: 480px;
    align-items: stretch;
}

.ex3d-angle-card .device-control-title {
    width: 100%;
    text-align: center;
}

.ex3d-volume-card {
    flex: 0 0 402px;
    width: 402px;
    min-width: 402px;
    align-items: stretch;
}

.ex3d-volume-card .device-control-title {
    width: 100%;
    text-align: center;
}

.ex3d-limiter-card {
    flex: 0 0 1100px;
    width: 1100px;
    min-width: 1100px;
    align-items: stretch;
}

.ex3d-fps-row .ex3d-right-spacer {
    display: none;
}

.ex3d-fps-row {
    width: 1100px;
}

.ex3d-angle-card {
    flex: 0 0 680px;
    width: 680px;
    min-width: 680px;
}

.ex3d-right-spacer {
    flex: 0 1 38%;
    min-width: 420px;
}

.ex3d-angle-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

.ex3d-angle-row {
    display: grid;
    grid-template-columns: 120px 1fr 130px;
    align-items: center;
    gap: 12px;
}

.ex3d-angle-label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
    font-size: 0.95rem;
    white-space: nowrap;
}

.ex3d-angle-ch {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.ex3d-angle-slider {
    width: 100%;
}

.ex3d-angle-number-wrap {
    width: 110px;
    display: block;
}

.ex3d-angle-number {
    width: 110px;
    box-sizing: border-box;
}

.ex3d-meter {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    height: 160px;
}

.ex3d-meter-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 40px;
}

.ex3d-meter-bar {
    width: 14px;
    height: 120px;
    border-radius: 6px;
    background: rgba(128,128,128,0.2);
    border: 1px solid #888888;
    overflow: hidden;
    position: relative;
}

.ex3d-volume-card .ex3d-meter {
    height: 220px;
    margin-top: auto;
}

.ex3d-volume-card .ex3d-meter-bar {
    height: 170px;
}

.ex3d-meter-fill {
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 0%;
    background: #d2b16f;
}

.ex3d-meter-label {
    margin-top: 6px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.ex3d-channels-section {
    margin-top: -12px;
}

.ex3d-channels-section .ex3d-meter {
    height: 220px;
}

.ex3d-channels-section .ex3d-meter-bar {
    height: 170px;
}

.volume-control,
.filter-mode-control {
    width: 312px;
}

.led-control,
.uac-control,
.game-mode-control,
.gain-mode-control {
    width: 260px;
}

.device-control-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.8rem;
}

.led-control-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

.led-preview {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    background-color: transparent;
}

.led-status-text {
    margin-top: 0.7rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    min-height: 1rem;
}

.led-color-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 0.8rem;
}

.led-color-option {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
}

.led-color-option[data-color="red"] { background-color: #ff4d4f; }
.led-color-option[data-color="green"] { background-color: #52c41a; }
.led-color-option[data-color="yellow"] { background-color: #fadb14; }
.led-color-option[data-color="cyan"] { background-color: #13c2c2; }
.led-color-option[data-color="purple"] { background-color: #722ed1; }

.led-color-option.active {
    border-color: #333;
}

.device-volume-slider {
    touch-action: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 260px;
    height: 6px;
    background: rgba(128,128,128,0.2);
    border-radius: 5px;
    border: 1px solid #888888;
    position: relative;
    outline: none;
}

.device-volume-slider::before {
    content: '';
    position: absolute;
    left: 0;
    top: -1px;
    bottom: -1px;
    width: var(--slider-fill-width, 0%);
    background: #d2b16f;
    border-radius: 5px;
    pointer-events: none;
}

.device-volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid #d2b16f;
    background: white;
    cursor: pointer;
    position: relative;
    z-index: 1;
}

.device-volume-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid #d2b16f;
    background: white;
    cursor: pointer;
    position: relative;
    z-index: 1;
}

.device-volume-slider::-moz-range-track {
    background: transparent;
}

.device-volume-input {
    width: 110px;
    height: 32px;
    padding: 4px 6px;
    padding-right: 28px;
    border: 1px solid #fcfcfc;
    border-radius: 3px;
    text-align: center;
    font-size: 13px;
}

.volume-slider-row {
    margin-bottom: 0.8rem;
}

body.dark-mode .device-volume-input {
    background-color: #2c2c2c !important;
    color: #ffffff !important;
    border: 1px solid #555 !important;
}

.uac-mode-toggle {
    display: flex;
    gap: 12px;
}

.uac-mode-button {
    padding: 6px 14px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-primary);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.uac-mode-button.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.mode-toggle {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

.mode-button {
    padding: 6px 14px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-primary);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mode-button.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.device-filter-select {
    width: 260px;
    height: 32px;
    padding: 4px 10px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-primary);
    font-size: 13px;
    box-sizing: border-box;
}

/* 预设选项网格容器 */
.preset-grid-container {
    display: flex;
    justify-content: center;
    padding: 2rem;
    border-radius: 12px;
    background: var(--card-bg);
}

.preset-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 1.5rem;
    width: 100%;
    max-width: 1000px;
    padding: 1rem;
}

/* 预设按钮样式 */
.preset-button {
    height: 3.5rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--card-bg);
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preset-button:hover:not(:disabled) {
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(220, 38, 127, 0.2);
}

.preset-button:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(220, 38, 127, 0.2);
}

/* 已选中的预设按钮 */
.preset-button.active {
    background: var(--primary-color) !important;
    background-color: var(--primary-color) !important;
    color: white !important;
    border-color: var(--primary-color) !important;
    box-shadow: 0 2px 8px rgba(220, 38, 127, 0.4) !important;
}

/* 确保选中状态在hover时也保持 */
.preset-button.active:hover {
    background: var(--primary-color) !important;
    background-color: var(--primary-color) !important;
    color: white !important;
    border-color: var(--primary-color) !important;
    transform: none !important;
}

/* 空白按钮（占位用） */
.preset-button.preset-empty {
    border: 2px dashed var(--border-color);
    color: var(--text-secondary);
    cursor: not-allowed;
    opacity: 0.3;
    background: transparent;
    box-shadow: none;
}

/* 未连接设备时的样式 - 移除禁用状态，允许选择 */
.device-disconnected .preset-button:not(.preset-empty) {
    border-color: var(--border-color);
    color: var(--text-secondary);
    cursor: pointer;
}

.device-disconnected .preset-button:not(.preset-empty):hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(220, 38, 127, 0.2);
}

/* 已连接设备时的样式 */
.device-connected .preset-button:not(.preset-empty) {
    border-color: var(--border-color);
    color: var(--text-primary);
    cursor: pointer;
}

.device-connected .preset-button:not(.preset-empty):hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(220, 38, 127, 0.2);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .preset-grid {
        max-width: 600px;
        gap: 1rem;
        padding: 0.5rem;
    }
    
    .preset-button {
        height: 3rem;
        font-size: 0.9rem;
    }
    
    .preset-grid-container {
        padding: 1.5rem;
    }
}

@media (max-width: 480px) {
    .preset-grid {
        max-width: 400px;
        gap: 0.8rem;
    }
    
    .preset-button {
        height: 2.5rem;
        font-size: 0.8rem;
    }
    
    .preset-grid-container {
        padding: 1rem;
    }
}

/* 夜间模式下的设备页面样式 */
body.dark-mode .device-status-card {
    background: #2d3748;
    border-color: #4a5568;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

body.dark-mode .device-status-card h3 {
    color: #f7fafc;
}

body.dark-mode .device-item {
    border-bottom-color: #4a5568;
}

body.dark-mode .device-label {
    color: #e2e8f0;
}

body.dark-mode .device-value {
    color: #a0aec0;
}

body.dark-mode .device-btn.secondary {
    background: #4a5568;
    color: #e2e8f0;
    border-color: #718096;
}

body.dark-mode .device-btn.secondary:hover {
    background: #718096;
}
