#gorgone-config-panel,
#gorgone-config-panel * {
    box-sizing: border-box;
}

#gorgone-config-panel {
    display: none;
    position: fixed;
    top: 18px;
    right: 18px;
    width: min(460px, calc(100vw - 36px));
    max-height: calc(100vh - 36px);
    overflow: auto;
    z-index: 10000;
    padding: 14px;
    color: #e9eeee;
    background: rgba(13, 17, 18, 0.94);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 14px;
    box-shadow: 0 22px 70px rgba(0,0,0,0.45);
    font-family: 'Oxygen', sans-serif;
    font-size: 12px;
    backdrop-filter: blur(12px);
}

#gorgone-config-panel.is-open {
    display: block;
}

.hmx-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.hmx-title {
    font-weight: 700;
    font-size: 15px;
    letter-spacing: 0.02em;
}

.hmx-close {
    border: 0;
    border-radius: 999px;
    width: 26px;
    height: 26px;
    color: #fff;
    background: rgba(255,255,255,0.12);
}

.hmx-tabs,
.hmx-subtabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 10px 0;
}

.hmx-tab,
.hmx-subtab,
.hmx-button {
    border: 1px solid rgba(255,255,255,0.14);
    border-radius: 9px;
    padding: 7px 9px;
    color: #e9eeee;
    background: rgba(255,255,255,0.08);
    cursor: pointer;
}

.hmx-tab.is-active,
.hmx-subtab.is-active,
.hmx-button:hover {
    background: rgba(255,255,255,0.18);
}

.hmx-button[disabled],
.hmx-button[disabled]:hover {
    cursor: not-allowed;
    opacity: 0.38;
    background: rgba(255,255,255,0.05);
}

.hmx-section,
.hmx-membrane {
    display: none;
}

.hmx-section.is-active,
.hmx-membrane.is-active {
    display: block;
}

.hmx-row {
    display: grid;
    grid-template-columns: 152px 1fr;
    gap: 10px;
    align-items: center;
    min-height: 32px;
    margin: 7px 0;
}

.hmx-row label {
    color: #b9c4c4;
}

.hmx-row input[type="text"],
.hmx-row input[type="number"],
.hmx-row input[type="file"],
.hmx-row select {
    width: 100%;
    min-width: 0;
    border: 1px solid rgba(255,255,255,0.14);
    border-radius: 8px;
    padding: 6px 8px;
    color: #f5ffff;
    background: #151a1b;
}

.hmx-row input[type="color"] {
    width: 54px;
    height: 28px;
    padding: 0;
    border: 0;
    background: transparent;
}

.hmx-row input[type="range"] {
    width: 100%;
}

.hmx-inline {
    display: flex;
    gap: 6px;
    align-items: center;
}

.hmx-inline > * {
    min-width: 0;
}

.hmx-muted {
    color: #8d9b9b;
    font-size: 11px;
}

.hmx-divider {
    height: 1px;
    margin: 12px 0;
    background: rgba(255,255,255,0.11);
}

.hmx-chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 7px;
}

.hmx-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 100%;
    padding: 4px 6px;
    border-radius: 999px;
    color: #d9eeee;
    background: rgba(255,255,255,0.09);
}

.hmx-chip button {
    border: 0;
    width: 18px;
    height: 18px;
    border-radius: 999px;
    color: #fff;
    background: rgba(255,255,255,0.16);
    cursor: pointer;
}

.hmx-status {
    min-height: 18px;
    margin-top: 8px;
    color: #abcaca;
    font-size: 11px;
}

.hmx-danger {
    color: #ffb5b5;
}

@media (max-width: 640px) {
    #gorgone-config-panel {
        left: 10px;
        right: 10px;
        top: 10px;
        width: auto;
        max-height: calc(100vh - 20px);
    }

    .hmx-row {
        grid-template-columns: 1fr;
        gap: 4px;
    }
}


.hmx-fill {
    align-items: stretch;
}

.hmx-fill .hmx-combo {
    flex: 1 1 auto;
}

.hmx-slider {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 72px;
    gap: 8px;
    align-items: center;
}

.hmx-slider output {
    justify-self: end;
    min-width: 62px;
    color: #dceeee;
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.hmx-combo {
    position: relative;
    min-width: 0;
}

.hmx-combo-toggle {
    display: flex;
    width: 100%;
    min-height: 31px;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    border: 1px solid rgba(255,255,255,0.14);
    border-radius: 8px;
    padding: 6px 8px;
    color: #f5ffff;
    background: #151a1b;
    cursor: pointer;
    text-align: left;
}

.hmx-combo-toggle span:first-child {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hmx-combo-menu {
    display: none;
    position: absolute;
    z-index: 10002;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    max-height: 220px;
    overflow: auto;
    border: 1px solid rgba(255,255,255,0.14);
    border-radius: 9px;
    background: #111617;
    box-shadow: 0 12px 36px rgba(0,0,0,0.45);
}

.hmx-combo.is-open .hmx-combo-menu {
    display: block;
}

.hmx-combo-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 28px;
    align-items: center;
    gap: 6px;
    min-height: 31px;
    padding: 3px 4px 3px 8px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    cursor: pointer;
}

.hmx-combo-item:hover {
    background: rgba(255,255,255,0.09);
}

.hmx-combo-item-main {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hmx-combo-delete {
    width: 24px;
    height: 24px;
    border: 0;
    border-radius: 999px;
    color: #fff;
    background: rgba(255,255,255,0.14);
    cursor: pointer;
}

.hmx-combo-delete:hover {
    background: rgba(255,96,96,0.42);
}

.hmx-combo-delete[disabled] {
    cursor: not-allowed;
    opacity: 0.35;
}

.hmx-combo-empty {
    padding: 9px;
    color: #8d9b9b;
}

.hmx-file-hidden {
    display: none;
}

.hmx-dropzone {
    display: grid;
    place-items: center;
    min-height: 82px;
    padding: 13px;
    border: 1.5px dashed rgba(210, 240, 240, 0.38);
    border-radius: 12px;
    color: #dceeee;
    background: rgba(255,255,255,0.045);
    cursor: pointer;
    text-align: center;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.hmx-dropzone span {
    display: block;
    margin-top: 4px;
    color: #8d9b9b;
    font-size: 11px;
}

.hmx-dropzone.is-dragover,
.hmx-dropzone:hover {
    border-color: rgba(210, 240, 240, 0.75);
    background: rgba(255,255,255,0.095);
    transform: translateY(-1px);
}

.hmx-button.hmx-button-danger {
    color: #ffdede;
    border-color: rgba(255,120,120,0.28);
    background: rgba(255,80,80,0.10);
}

.hmx-button.hmx-button-danger:hover {
    background: rgba(255,80,80,0.22);
}


.hmx-icon-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.hmx-icon-button svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.hmx-material-box {
    padding: 10px;
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: 12px;
    background: rgba(255,255,255,0.035);
}

#gorgone-emitter-overlay {
    position: fixed;
    inset: 0;
    z-index: 9997;
    pointer-events: none;
}

.gorgone-emitter {
    position: absolute;
    width: 46px;
    height: 46px;
    transform: translate(-50%, -50%);
    pointer-events: auto;
}

.gorgone-emitter-box {
    position: absolute;
    left: 11px;
    top: 11px;
    width: 24px;
    height: 24px;
    border: 1px solid rgba(255,255,255,0.85);
    background: rgba(0,0,0,0.08);
    box-shadow: 0 0 12px rgba(255,255,255,0.25);
}

.gorgone-emitter.is-selected .gorgone-emitter-box {
    border-color: #fff;
    box-shadow: 0 0 0 1px #fff, 0 0 18px rgba(255,255,255,0.55);
}

.gorgone-emitter button {
    display: none;
    position: absolute;
    width: 18px;
    height: 18px;
    padding: 0;
    border: 0;
    border-radius: 4px;
    color: #fff;
    background: rgba(0,0,0,0.55);
    font-size: 10px;
    line-height: 18px;
    cursor: grab;
}

.gorgone-emitter.is-selected button,
.gorgone-emitter:hover button {
    display: block;
}

.gorgone-emitter [data-emitter-arrow="up"] {
    left: 14px;
    top: -7px;
}

.gorgone-emitter [data-emitter-arrow="right"] {
    right: -7px;
    top: 14px;
}

.gorgone-emitter [data-emitter-arrow="down"] {
    left: 14px;
    bottom: -7px;
}

.gorgone-emitter [data-emitter-arrow="left"] {
    left: -7px;
    top: 14px;
}

.gorgone-emitter .gorgone-emitter-angle {
    right: -8px;
    bottom: -8px;
    border-radius: 999px;
    background: rgba(255,255,255,0.20);
}

.hmx-row .hmx-inline input[type="text"] {
    flex: 1 1 auto;
}


/* v3: seletores de emissor só aparecem enquanto a caixa de configuração está aberta. */
#gorgone-emitter-overlay {
    display: none;
}

body.gorgone-config-open #gorgone-emitter-overlay {
    display: block;
}

.hmx-icon-button {
    width: 34px;
    min-width: 34px;
    height: 32px;
    justify-content: center;
    padding: 7px;
    gap: 0;
}

.hmx-icon-button svg {
    display: block;
}



.gorgone-target {
    position: absolute;
    width: 38px;
    height: 38px;
    transform: translate(-50%, -50%);
    pointer-events: auto;
    cursor: move;
}

.gorgone-target-ring {
    position: absolute;
    inset: 5px;
    border: 1px dashed rgba(120, 220, 255, 0.95);
    border-radius: 999px;
    background: rgba(50, 180, 255, 0.08);
    box-shadow: 0 0 15px rgba(120, 220, 255, 0.22);
}

.gorgone-target-cross::before,
.gorgone-target-cross::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    background: rgba(120, 220, 255, 0.95);
    transform: translate(-50%, -50%);
}

.gorgone-target-cross::before {
    width: 24px;
    height: 1px;
}

.gorgone-target-cross::after {
    width: 1px;
    height: 24px;
}

.gorgone-target.is-selected .gorgone-target-ring {
    border-color: #fff;
    box-shadow: 0 0 0 1px #fff, 0 0 18px rgba(120,220,255,0.6);
}
