/* settings.css —— 设置面板样式 */

#settings-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 15, 25, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 200;
    overflow-y: auto;
    padding: 40px 20px;
    /* 显示时由 JS 设为 flex；行布局使左侧目录 sticky 固定 */
    flex-direction: row;
    justify-content: center;
    align-items: flex-start;
    gap: 24px;
}

.settings-wrap {
    max-width: 720px;
    margin: 0;
    background: rgba(20, 30, 45, 0.95);
    border: 1px solid rgba(100, 200, 255, 0.3);
    border-radius: 12px;
    padding: 30px 40px;
}

/* 左侧目录（sticky 跟随面板滚动，滚动容器是 #settings-panel） */
.settings-nav {
    position: sticky;
    top: 40px;
    align-self: flex-start;
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: calc(100vh - 80px);
    overflow-y: auto;
    padding: 8px;
    background: rgba(15, 22, 34, 0.92);
    border: 1px solid rgba(100, 200, 255, 0.25);
    border-radius: 10px;
    z-index: 1;
}

.settings-nav button {
    padding: 6px 12px;
    background: transparent;
    border: none;
    border-radius: 5px;
    color: #aabbcc;
    font-size: 13px;
    text-align: left;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.15s;
}

.settings-nav button:hover {
    background: rgba(100, 200, 255, 0.15);
    color: #00ddff;
}

@media (max-width: 1080px) {
    .settings-nav {
        display: none;
    }
}

.settings-wrap h2 {
    color: #00ddff;
    margin-bottom: 20px;
    font-size: 24px;
}

/* 预设槽 */
.preset-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(100, 200, 255, 0.15);
}

.preset-row span {
    color: #aabbcc;
    font-size: 14px;
}

.preset-row button {
    padding: 6px 12px;
    background: rgba(100, 200, 255, 0.1);
    border: 1px solid rgba(100, 200, 255, 0.3);
    color: #00ddff;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.preset-row button:hover {
    background: rgba(100, 200, 255, 0.2);
}

.preset-row .reset-btn {
    background: rgba(255, 100, 100, 0.1);
    border-color: rgba(255, 100, 100, 0.3);
    color: #ff6666;
    margin-left: auto;
}

.preset-row .reset-btn:hover {
    background: rgba(255, 100, 100, 0.2);
}

/* 分组 */
.settings-group {
    margin-bottom: 28px;
    scroll-margin-top: 40px;
}

.settings-group h3 {
    color: #88aacc;
    font-size: 16px;
    margin-bottom: 12px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(100, 200, 255, 0.1);
}

/* 分组说明：标题下方的灰色小字提示（如灵敏度单位解释） */
.settings-note {
    font-size: 12px;
    line-height: 1.6;
    color: #8fa2b8;
    background: rgba(0, 0, 0, 0.25);
    border-left: 3px solid rgba(100, 200, 255, 0.35);
    border-radius: 4px;
    padding: 10px 12px;
    margin-bottom: 14px;
}

.settings-note b {
    color: #c8d8e8;
}

.settings-note code {
    color: #00ddff;
    font-family: "Consolas", monospace;
    background: rgba(0, 0, 0, 0.35);
    padding: 1px 4px;
    border-radius: 3px;
}

.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    gap: 16px;
}

.settings-row label {
    color: #aabbcc;
    font-size: 14px;
    flex-shrink: 0;
    min-width: 140px;
}

.settings-row select,
.settings-row input[type="number"],
.settings-row input[type="color"] {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(100, 200, 255, 0.2);
    color: #fff;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 14px;
    flex: 1;
    max-width: 200px;
}

.settings-row select:focus,
.settings-row input:focus {
    outline: none;
    border-color: rgba(100, 200, 255, 0.5);
}

.settings-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #00ddff;
    cursor: pointer;
}

/* range 滑块 */
.range-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    max-width: 280px;
}

.range-wrap input[type="range"] {
    flex: 1;
    accent-color: #00ddff;
    cursor: pointer;
}

.range-value {
    min-width: 60px;
    text-align: right;
    color: #00ddff;
    font-family: monospace;
    font-size: 13px;
}

/* 键位绑定 */
.keybind-row {
    margin-bottom: 8px;
}

.keybind-btn {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(100, 200, 255, 0.3);
    color: #00ddff;
    padding: 6px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-family: monospace;
    font-size: 14px;
    min-width: 120px;
    transition: all 0.2s;
}

.keybind-btn:hover {
    background: rgba(100, 200, 255, 0.15);
}

.keybind-btn.rebinding {
    background: rgba(255, 170, 0, 0.2);
    border-color: rgba(255, 170, 0, 0.5);
    color: #ffaa00;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* 右侧悬浮保存按钮（固定定位，无需滚动到底部）。
   挂在 body 上，z-index 需高于 #settings-panel(200) 才不被面板背景盖住；
   低于确认弹窗(300)。 */
.settings-save-fab {
    position: fixed;
    right: 28px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 210;
    padding: 16px 20px;
    background: linear-gradient(135deg, #00cc66, #009944);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 0 18px rgba(0, 200, 100, 0.4);
    transition: all 0.2s;
}

.settings-save-fab:hover {
    background: linear-gradient(135deg, #00dd77, #00aa55);
    box-shadow: 0 0 24px rgba(0, 220, 120, 0.6);
}

/* 未保存确认弹窗 */
.settings-confirm {
    position: fixed;
    inset: 0;
    z-index: 300;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.settings-confirm .confirm-card {
    background: rgba(20, 30, 45, 0.98);
    border: 1px solid rgba(100, 200, 255, 0.35);
    border-radius: 12px;
    padding: 28px 36px;
    text-align: center;
    box-shadow: 0 0 40px rgba(0, 150, 255, 0.3);
}

.settings-confirm .confirm-title {
    color: #00ddff;
    font-size: 18px;
    margin-bottom: 8px;
}

.settings-confirm .confirm-sub {
    color: #aabbcc;
    font-size: 14px;
    margin-bottom: 20px;
}

.settings-confirm .confirm-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.settings-confirm button {
    padding: 10px 18px;
    border-radius: 6px;
    border: none;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.confirm-save {
    background: linear-gradient(135deg, #00aaff, #0066cc);
    color: #fff;
}

.confirm-save:hover {
    background: linear-gradient(135deg, #00bbff, #0077dd);
}

.confirm-discard {
    background: rgba(255, 100, 100, 0.15);
    border: 1px solid rgba(255, 100, 100, 0.4) !important;
    color: #ff8888;
}

.confirm-discard:hover {
    background: rgba(255, 100, 100, 0.3);
}

.settings-confirm .confirm-hint {
    margin-top: 14px;
    font-size: 12px;
    color: #667788;
}

/* 关闭按钮 */
.close-btn {
    display: block;
    width: 100%;
    padding: 12px;
    margin-top: 20px;
    background: linear-gradient(135deg, #00aaff, #0066cc);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
}

.close-btn:hover {
    background: linear-gradient(135deg, #00bbff, #0077dd);
    box-shadow: 0 0 20px rgba(0, 170, 255, 0.5);
}

/* 滚动条样式 */
#settings-panel::-webkit-scrollbar {
    width: 8px;
}

#settings-panel::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
}

#settings-panel::-webkit-scrollbar-thumb {
    background: rgba(100, 200, 255, 0.3);
    border-radius: 4px;
}

#settings-panel::-webkit-scrollbar-thumb:hover {
    background: rgba(100, 200, 255, 0.5);
}
