* {
    box-sizing: border-box;
}

:root {
    --bg1: #2b2c32;
    --bg2: #202127;
    --bg3: #1b1c22;
    --line: rgba(255, 255, 255, .07);
    --text: rgba(255, 255, 255, .96);
    --muted: rgba(255, 255, 255, .62);
    --panel: rgba(10, 11, 14, .96);
    --chip: #35373d;
    --chip-active: #4a82f6;
    --chip-off: rgba(122, 162, 255, .9);
    --blue: #4f86ff;
    --circle: #25282d;
    --track: rgba(255, 255, 255, .12);
    --btn-outline: rgba(255, 255, 255, .06);
    --btn-outline-hover: rgba(255, 255, 255, .12);
    --btn-solid: #3d3d40;
    --btn-solid-hover: #4a4a4e;
    --btn-disabled: rgba(255, 255, 255, .04);
    --gold: #e1bc70;
    --gold-soft: #f0d495;

    --circle-size: 32px;
    --band-gap: 4px;
    --track-height: 218px;
    --thumb-size: 22px;
}

/* html,
body {
    margin: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    background: linear-gradient(90deg, var(--bg1) 0%, var(--bg2) 46%, var(--bg3) 100%);
    color: var(--text);
}

body {
    display: flex;
    align-items: stretch;
    justify-content: stretch;
} */

.window {
    width: 100%;
    min-height: 100%;
    display: flex;
    flex-direction: column;
    background: linear-gradient(90deg, rgba(255, 255, 255, .02) 0%, rgba(255, 255, 255, 0) 55%);
}

.topbar {
    height: 82px;
    flex: 0 0 82px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    border-bottom: 1px solid var(--line);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.title {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: .2px;
}

.switch {
    position: relative;
    width: 54px;
    height: 28px;
    flex: 0 0 auto;
}

.switch input {
    display: none;
}

.switch-slider {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: #55575b;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .05);
    cursor: pointer;
    transition: .18s ease;
}

.switch-slider::after {
    content: "";
    position: absolute;
    left: 3px;
    top: 3px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .94);
    transition: .2s ease;
    box-shadow: 0 3px 8px rgba(0, 0, 0, .22);
}

.switch input:checked+.switch-slider {
    background: var(--blue);
}

.switch input:checked+.switch-slider::after {
    transform: translateX(26px);
}

.close-btn {
    width: 42px;
    height: 42px;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, .84);
    font-size: 32px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
}

.eq_content {
    flex: 1;
    min-height: 0;
    width: 100%;
    max-width: 1560px;
    margin: 0 auto;
    padding: 20px 40px 18px;
    display: flex;
    flex-direction: column;
}

.mode-tabs {
    display: flex;
    gap: 58px;
    margin-bottom: 16px;
    padding-left: 2px;
}

.mode-tab {
    position: relative;
    border: none;
    background: transparent;
    color: var(--muted);
    font-size: 17px;
    font-weight: 700;
    padding: 0 0 14px;
    cursor: pointer;
}

.mode-tab.active {
    color: #fff;
}

.mode-tab.active::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 0;
    width: 28px;
    height: 4px;
    transform: translateX(-50%);
    border-radius: 999px;
    background: rgba(255, 255, 255, .96);
}

.preset-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
    min-height: 42px;
}

.preset-chip {
    min-width: 92px;
    height: 40px;
    padding: 0 16px;
    border-radius: 4px;
    border: 1px solid transparent;
    color: rgba(255, 255, 255, .75);
    font-size: 15px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
    transition: .16s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.preset-chip.system {
    background: #383838;
    color: rgba(255, 255, 255, .75);
}

.preset-chip.custom {
    background: rgba(14, 17, 23, .32);
    border-color: rgba(255, 255, 255, .28);
    color: rgba(255, 255, 255, .75);
}

.preset-chip.system:not(.active):not(.off-selected):not(.pinned):hover {
    background: #383838;
    color: rgba(255, 255, 255, .75);
    border-color: transparent;
    box-shadow: none;
    filter: none;
}

.preset-chip.custom:not(.active):not(.off-selected):hover {
    background: #2E374E;
    border: 1px solid #376BED;
    color: #FFFFFF;
    box-shadow: none;
}

.preset-chip.active {
    background: var(--chip-active);
    color: #eef4ff;
    border-color: transparent;
    box-shadow: none;
}

.preset-chip.off-selected {
    background: #9db8ff;
    color: #eef4ff;
    border-color: transparent;
    box-shadow: none;
}

.preset-chip.pinned {
    background: #101114;
    color: var(--gold);
    border-color: transparent;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .02);
}

.preset-chip.pinned:not(.active):not(.off-selected):hover {
    background: #18191d;
    color: var(--gold-soft);
    border-color: transparent;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .02);
}

.preset-chip.pinned.active {
    background: var(--chip-active);
    color: var(--gold-soft);
}

.preset-chip.pinned.off-selected {
    background: #a5befd;
    color: var(--gold-soft);
}

.preset-chip.add {
    min-width: 44px;
    width: 44px;
    padding: 0;
    font-size: 30px;
    line-height: 1;
    background: transparent;
    color: rgba(255, 255, 255, .75);
    border-color: rgba(255, 255, 255, .28);
    border-radius: 4px;
    align-items: center;
    justify-content: center;
    transform: translateY(-1px);
}


.preset-chip.editing {
    padding: 0 10px;
    cursor: text;
    box-shadow: 0 0 0 1px rgba(79, 134, 255, .55) inset;
    border-color: rgba(79, 134, 255, .75);
}

.preset-chip-input {
    width: 100%;
    height: 100%;
    border: none;
    outline: none;
    background: transparent;
    color: #fff;
    font-size: 15px;
    text-align: center;
    padding: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.freq.editing {
    min-width: 52px;
    height: 24px;
    padding: 0 6px;
    border-radius: 6px;
    box-shadow: 0 0 0 1px rgba(79, 134, 255, .55) inset;
    background: rgba(79, 134, 255, .08);
}

.freq-input {
    width: 100%;
    height: 100%;
    border: none;
    outline: none;
    background: transparent;
    color: rgba(255, 255, 255, .92);
    font-size: 13px;
    text-align: center;
    padding: 0;
}

.eq-panel {
    background: var(--panel);
    border-radius: 18px;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .03);
    padding: 30px 36px 24px 34px;
    display: flex;
    gap: 6px;
    overflow: hidden;
}

.db-axis {
    width: 92px;
    flex: 0 0 92px;
    display: flex;
    justify-content: flex-end;
    padding-top: calc(var(--circle-size) + var(--band-gap));
    padding-right: 10px;
}

.axis-scale {
    position: relative;
    width: 66px;
    height: var(--track-height);
}

.axis-group {
    position: absolute;
    right: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    transform: translateY(-50%);
    pointer-events: none;
}

.axis-label {
    min-width: 38px;
    text-align: right;
    font-size: 14px;
    color: rgba(255, 255, 255, .7);
}

.axis-line {
    width: 18px;
    height: 2px;
    background: rgba(255, 255, 255, .16);
    border-radius: 999px;
}

.bands {
    flex: 1;
    min-width: 0;
    display: grid;
    grid-template-columns: repeat(14, minmax(30px, 1fr));
    gap: 0;
    align-items: start;
}

.band {
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--band-gap);
}

.circle-btn {
    width: var(--circle-size);
    height: var(--circle-size);
    border: none;
    border-radius: 50%;
    background: var(--circle);
    color: rgba(255, 255, 255, .92);
    font-size: 22px;
    font-weight: 700;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    transition: .18s ease;
    flex: 0 0 auto;
}

.slider-wrap {
    position: relative;
    width: 32px;
    height: calc(var(--track-height) + var(--thumb-size));
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: visible;
}

.track {
    position: relative;
    width: 8px;
    height: var(--track-height);
    border-radius: 999px;
    background: var(--track);
    margin: calc(var(--thumb-size) / 2) 0;
    touch-action: none;
}

.fill {
    position: absolute;
    left: 0;
    width: 100%;
    border-radius: 999px;
    background: var(--blue);
    display: none;
}

.thumb {
    position: absolute;
    left: 50%;
    top: 0;
    width: var(--thumb-size);
    height: var(--thumb-size);
    border-radius: 50%;
    background: var(--blue);
    border: 3px solid #eef2fb;
    box-shadow: 0 3px 10px rgba(0, 0, 0, .3);
    transform: translate(-50%, -50%);
    cursor: grab;
}

.thumb:active {
    cursor: grabbing;
}

.freq {
    margin-top: 0;
    color: rgba(255, 255, 255, .62);
    font-size: 13px;
    line-height: 1;
}

.eq-panel.slider-disabled .track,
.eq-panel.slider-disabled .fill,
.eq-panel.slider-disabled .thumb,
.eq-panel.slider-disabled .circle-btn,
.eq-panel.slider-disabled .freq,
.eq-panel.slider-disabled .axis-label,
.eq-panel.slider-disabled .axis-line {
    opacity: .42;
}

.eq-panel.slider-disabled .thumb,
.eq-panel.slider-disabled .circle-btn,
.eq-panel.slider-disabled .track {
    cursor: default;
}

.eq-panel.slider-disabled .circle-btn {
    pointer-events: none;
}

.footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 73px;
}

.action-btn {
    min-width: 96px;
    height: 42px;
    border-radius: 8px;
    font-size: 15px;
    cursor: pointer;
    transition: .16s ease;
    color: rgba(255, 255, 255, .9);
}

.action-btn.secondary {
    border: 1px solid rgba(255, 255, 255, .18);
    background: rgba(255, 255, 255, .04);
}

.action-btn.secondary:hover:not(:disabled) {
    background: rgba(255, 255, 255, .08);
}

.action-btn.primary {
    border: 1px solid rgba(255, 255, 255, .08);
    background: #3f4044;
}

.action-btn.primary:hover:not(:disabled) {
    background: #4b4c50;
}

.action-btn:disabled {
    background: rgba(255, 255, 255, .03);
    color: rgba(255, 255, 255, .28);
    border-color: rgba(255, 255, 255, .08);
    cursor: not-allowed;
}

.action-btn.danger {
    border: 1px solid rgba(171, 74, 86, .9);
    background: rgba(255, 255, 255, .03);
    color: #d45d6a;
}

.action-btn.danger:hover:not(:disabled) {
    background: rgba(171, 74, 86, .10);
    color: #e46b77;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
    padding: 20px;
}

.modal-overlay[hidden] {
    display: none !important;
}

.toast {
    position: fixed;
    left: 50%;
    bottom: 28px;
    transform: translateX(-50%);
    min-width: 120px;
    max-width: min(360px, calc(100vw - 40px));
    padding: 10px 16px;
    border-radius: 10px;
    background: rgba(24, 25, 31, .92);
    color: rgba(255, 255, 255, .92);
    font-size: 14px;
    text-align: center;
    box-shadow: 0 8px 28px rgba(0, 0, 0, .28);
    z-index: 30;
    opacity: 0;
    pointer-events: none;
    transition: opacity .18s ease;
}

.toast.show {
    opacity: 1;
}

.modal-card {
    width: min(420px, 100%);
    background: linear-gradient(180deg, #2c2d33 0%, #22232a 100%);
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 14px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, .35);
    padding: 18px;
}

.modal-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 10px;
}

.modal-message {
    color: rgba(255, 255, 255, .78);
    font-size: 14px;
    line-height: 1.6;
    min-height: 22px;
}

.modal-input-wrap {
    margin-top: 12px;
}

.modal-input {
    width: 100%;
    height: 42px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, .16);
    background: rgba(255, 255, 255, .06);
    color: #fff;
    font-size: 15px;
    padding: 0 12px;
    outline: none;
}

.modal-input:focus {
    border-color: rgba(79, 134, 255, .85);
    box-shadow: 0 0 0 1px rgba(79, 134, 255, .5) inset;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 16px;
}

.modal-actions button[hidden] {
    display: none !important;
}

@media (max-width: 1400px) {
    :root {
        --track-height: 184px;
        --circle-size: 28px;
        --thumb-size: 18px;
    }

    .topbar {
        height: 76px;
        flex-basis: 76px;
        padding: 0 20px;
    }

    .title {
        font-size: 20px;
    }

    .eq_content {
        max-width: 1460px;
        padding: 16px 24px 14px;
    }

    .mode-tabs {
        gap: 48px;
        margin-bottom: 12px;
    }

    .mode-tab {
        font-size: 16px;
    }

    .preset-row {
        gap: 8px;
        margin-bottom: 10px;
    }

    .preset-chip {
        min-width: 84px;
        height: 38px;
        font-size: 14px;
        padding: 0 14px;
        border-radius: 12px;
    }

    .preset-chip.add {
        min-width: 40px;
        width: 40px;
    }

    .eq-panel {
        padding: 20px 18px 14px 18px;
    }

    .db-axis {
        width: 82px;
        flex-basis: 82px;
    }

    .axis-scale {
        width: 60px;
    }

    .axis-label {
        font-size: 13px;
        min-width: 34px;
    }

    .axis-line {
        width: 16px;
    }

    .bands {
        gap: 2px;
    }

    .slider-wrap {
        width: 30px;
    }

    .circle-btn {
        font-size: 20px;
    }

    .freq {
        font-size: 12px;
    }

    .footer {
        padding-top: 73px;
    }

    .action-btn {
        min-width: 88px;
        height: 40px;
        font-size: 14px;
    }
}

/* ===== Layui EQ slider style (ported from old project) ===== */
.bands {
    align-items: start;
}

.band {
    width: 36px;
    align-items: end;
    gap: 0;
}

.band .eq-slider {
    height: var(--track-height);
    width: 30px;
    position: relative;
}

.band .layui-slider-vertical {
    background: #2e2e2e;
    border-radius: 3px;
    width: 6px !important;
    margin: 0 auto !important;
}

.band .layui-slider-bar {
    background-color: #376BED !important;
    width: 6px !important;
    left: 0 !important;
    border-radius: 3px !important;
}

.band .layui-slider-wrap-btn {
    width: 16px !important;
    height: 16px !important;
    border-radius: 50% !important;
    background: #376BED !important;
    margin-left: 2px !important;
    border: none !important;
    box-shadow: 0 0 0 2px #FFFFFF !important;
    transform: none !important;
    left: auto !important;
}

.slider-live-tip {
    position: absolute;
    left: 50%;
    transform: translate(-50%, -100%);
    background: rgba(36, 40, 49, 0.96);
    color: rgba(255, 255, 255, 0.96);
    border-radius: 4px;
    min-width: 28px;
    height: 24px;
    padding: 0 8px;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    line-height: 1;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity .12s ease;
    z-index: 80;
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, .08) inset;
}

.slider-live-tip::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: -5px;
    width: 10px;
    height: 10px;
    background: rgba(36, 40, 49, 0.96);
    transform: translateX(-50%) rotate(45deg);
    border-radius: 1px;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, .04) inset;
}

.band.tip-visible .slider-live-tip,
.band.tip-dragging .slider-live-tip {
    display: flex;
    opacity: 1;
    visibility: visible;
}

.band .layui-slider-tips {
    display: none !important;
}

.slider-control-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(39, 39, 39, 1);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    line-height: 1;
    user-select: none;
    cursor: pointer;
    margin: 0 0 10px 0;
    transition: .15s ease;
}

.slider-control-btn.minus-btn {
    margin: 10px 0 0 0;
}

.slider-control-btn:hover {
    filter: brightness(1.08);
}

.slider-control-btn.disabled {
    opacity: .5;
    cursor: not-allowed;
    pointer-events: none;
}

.band.slider-disabled {
    opacity: 1;
}

.band.slider-disabled .layui-slider-vertical {
    background: #2e2e2e;
    opacity: 1;
}

.band.slider-disabled .layui-slider-bar {
    background-color: #7397F2 !important;
    opacity: 1 !important;
}

.band.slider-disabled .layui-slider-wrap-btn {
    background: #7397F2 !important;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, .6) !important;
    opacity: 1 !important;
}

.band.slider-disabled .slider-control-btn,
.band.slider-disabled .freq {
    opacity: .78;
}

.eq-panel.slider-disabled .axis-label,
.eq-panel.slider-disabled .axis-line {
    opacity: .74;
}

.band .freq {
    width: 52px;
    text-align: center;
    margin-top: 16px;
    margin-left: -9px;
    font-size: 13px;
    color: rgba(255, 255, 255, .62);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: default;
}

.band .freq[data-freq-index] {
    cursor: text;
}

@media (max-width: 1400px) {
    .band {
        width: 34px;
    }

    .band .eq-slider {
        width: 28px;
    }

    .slider-control-btn {
        width: 28px;
        height: 30px;
        font-size: 20px;
    }

    .band .freq {
        width: 48px;
        margin-left: -8px;
        font-size: 12px;
    }
}