.gradio-button.tool.fmp-launcher {
    box-sizing: border-box !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex: 0 0 2.2em !important;
    width: 2.2em !important;
    min-width: 2.2em !important;
    max-width: 2.2em !important;
    height: 2.4em !important;
    min-height: 2.4em !important;
    max-height: 2.4em !important;
    padding: 0 !important;
    border: 1px solid var(--button-secondary-border-color, var(--border-color-primary)) !important;
    border-radius: 0.5em !important;
    background: var(--button-secondary-background-fill, var(--background-fill-secondary)) !important;
    color: var(--button-secondary-text-color, var(--body-text-color)) !important;
    font-size: var(--button-large-text-size, 16px) !important;
    font-weight: 700 !important;
    line-height: 1 !important;
    cursor: pointer;
    align-self: end !important;
    vertical-align: middle !important;
    margin: 0 !important;
}

.fmp-launcher-icon {
    display: block;
    font-size: 17px;
    line-height: 1;
}

.gradio-button.tool.fmp-launcher.fmp-playing .fmp-launcher-icon {
    color: #f97316;
}

.fmp-panel {
    box-sizing: border-box;
    position: fixed;
    z-index: 9000;
    right: 28px;
    bottom: 28px;
    width: min(420px, calc(100vw - 16px));
    max-height: min(680px, calc(100vh - 24px));
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--border-color-primary);
    border-radius: 8px;
    background: var(--background-fill-primary);
    color: var(--body-text-color);
    box-shadow: 0 16px 38px rgb(0 0 0 / 35%);
    pointer-events: auto;
}

.fmp-panel[hidden] {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

.fmp-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: 40px;
    padding: 6px 8px 6px 12px;
    border-bottom: 1px solid var(--border-color-primary);
    background: var(--background-fill-secondary);
    cursor: move;
    user-select: none;
}

.fmp-title {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
    flex: 1 1 auto;
    font-weight: 800;
}

.fmp-header-actions {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
}

.fmp-header-actions button,
.fmp-controls button,
.fmp-slot-top button,
.fmp-config button {
    box-sizing: border-box !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-width: 30px !important;
    min-height: 30px !important;
    padding: 0 8px !important;
    border-radius: 6px !important;
    border: 1px solid var(--button-secondary-border-color, var(--border-color-primary)) !important;
    background: var(--button-secondary-background-fill, var(--background-fill-secondary)) !important;
    color: var(--button-secondary-text-color, var(--body-text-color)) !important;
    cursor: pointer;
    font-weight: 700 !important;
    line-height: 1 !important;
}

.fmp-header-actions button:hover,
.fmp-controls button:hover,
.fmp-slot-top button:hover,
.fmp-config button:hover {
    filter: brightness(1.08);
}

.fmp-config {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto auto;
    gap: 6px;
    align-items: center;
    padding: 8px;
    border-bottom: 1px solid var(--border-color-primary);
}

.fmp-config input[type="text"],
.fmp-slot select {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    min-height: 32px;
    border: 1px solid var(--input-border-color, var(--border-color-primary));
    border-radius: 6px;
    background: var(--input-background-fill, var(--background-fill-primary));
    color: var(--input-text-color, var(--body-text-color));
    padding: 4px 8px;
}

.fmp-recursive {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 30px;
    color: var(--body-text-color-subdued);
    font-size: 12px;
    white-space: normal;
}

.fmp-bulk-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    grid-column: 1 / -1;
    min-width: 0;
}

.fmp-bulk-row .fmp-bulk-button {
    min-width: 58px !important;
    padding: 0 8px !important;
    font-size: 12px !important;
}

.fmp-status {
    min-height: 25px;
    padding: 5px 10px;
    color: var(--body-text-color-subdued);
    font-size: 12px;
}

.fmp-status[data-fmp-tone="warn"] {
    color: #d97706;
}

.fmp-slots {
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow: auto;
    padding: 0 8px 8px;
}

.fmp-slot {
    display: grid;
    gap: 7px;
    border: 1px solid var(--border-color-primary);
    border-radius: 8px;
    background: var(--background-fill-secondary);
    padding: 8px;
}

.fmp-slot-top {
    display: grid;
    grid-template-columns: 22px minmax(0, 1fr) 30px;
    align-items: center;
    gap: 7px;
}

.fmp-slot-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 999px;
    background: var(--background-fill-primary);
    color: var(--body-text-color-subdued);
    font-size: 12px;
    font-weight: 800;
}

.fmp-slot-spacer {
    display: block;
    width: 30px;
    height: 30px;
}

.fmp-controls {
    display: grid;
    grid-template-columns: 34px 64px 34px 38px minmax(78px, 1fr);
    align-items: center;
    gap: 6px;
}

.fmp-controls button {
    min-width: 34px !important;
    width: 34px !important;
    padding: 0 !important;
}

.fmp-controls .fmp-playstop {
    min-width: 64px !important;
    width: 64px !important;
    padding: 0 8px !important;
}

.fmp-loop {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-height: 30px;
    padding: 0 4px;
    border: 1px solid var(--border-color-primary);
    border-radius: 6px;
    background: var(--background-fill-primary);
    cursor: pointer;
}

.fmp-loop input {
    margin: 0;
}

.fmp-volume,
.fmp-progress input {
    width: 100%;
    min-width: 0;
}

.fmp-progress {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 82px;
    align-items: center;
    gap: 8px;
    color: var(--body-text-color-subdued);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

@media (max-width: 520px) {
    .fmp-panel {
        left: 8px !important;
        right: auto !important;
        width: calc(100vw - 16px);
    }

    .fmp-config {
        grid-template-columns: minmax(0, 1fr) auto auto auto;
    }

    .fmp-bulk-row {
        grid-column: 1 / -1;
    }

    .fmp-controls {
        grid-template-columns: 34px 64px 34px 38px minmax(64px, 1fr);
    }
}
